Skip to content

Commit f80e66c

Browse files
committed
fix: fix adding tracks & delete to change volume locally
1 parent 10fa54a commit f80e66c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

SimpleWebRTC/ViewController/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ViewController: UIViewController, WebSocketDelegate, WebRTCClientDelegate,
4343
var useCustomCapturer: Bool = false
4444

4545
// Constants
46-
let ipAddress: String = "192.168.11.4"
46+
let ipAddress: String = "192.168.1.25"
4747
let wsStatusMessageBase = "WebSocket: "
4848
let webRTCStatusMesasgeBase = "WebRTC: "
4949
let likeStr: String = "Like"
@@ -60,7 +60,7 @@ class ViewController: UIViewController, WebSocketDelegate, WebRTCClientDelegate,
6060

6161
webRTCClient = WebRTCClient()
6262
webRTCClient.delegate = self
63-
webRTCClient.setup(videoTrack: true, audioTrack: true, dataChannel: true, customFrameCapturer: useCustomCapturer)
63+
webRTCClient.setup(videoTrack: false, audioTrack: true, dataChannel: false, customFrameCapturer: useCustomCapturer)
6464

6565
if useCustomCapturer {
6666
print("--- use custom capturer ---")

SimpleWebRTC/WebRTC/WebRTCClient.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ class WebRTCClient: NSObject, RTCPeerConnectionDelegate, RTCVideoViewDelegate, R
122122
self.peerConnection = setupPeerConnection()
123123
self.peerConnection!.delegate = self
124124
if self.channels.video {
125-
self.peerConnection!.add(localAudioTrack, streamIds: ["stream-0"])
125+
self.peerConnection!.add(localVideoTrack, streamIds: ["stream-0"])
126126
}
127127
if self.channels.audio {
128-
self.peerConnection!.add(localVideoTrack, streamIds: ["stream-0"])
128+
self.peerConnection!.add(localAudioTrack, streamIds: ["stream-0"])
129129
}
130130
if self.channels.datachannel {
131131
self.dataChannel = self.setupDataChannel()
@@ -228,7 +228,8 @@ class WebRTCClient: NSObject, RTCPeerConnectionDelegate, RTCVideoViewDelegate, R
228228
let audioConstrains = RTCMediaConstraints(mandatoryConstraints: nil, optionalConstraints: nil)
229229
let audioSource = self.peerConnectionFactory.audioSource(with: audioConstrains)
230230
let audioTrack = self.peerConnectionFactory.audioTrack(with: audioSource, trackId: "audio0")
231-
audioTrack.source.volume = 10
231+
232+
// audioTrack.source.volume = 10
232233
return audioTrack
233234
}
234235

0 commit comments

Comments
 (0)