Ankit-Aggarwal / SwiftyWebRTC

Swift Framework for WebRTC
MIT License
159 stars 32 forks source link

Mute audio during call #18

Closed ryandailey100 closed 5 years ago

ryandailey100 commented 5 years ago

How can I mute my audio during an active audio call, so that the user cannot hear my end? I tried disabling the localAudioTrack but that did not work. Please let me know asap, thanks!

Ankit-Aggarwal commented 5 years ago

You mean you have initiated only audio call without video and disabled audio track added in localStream and it does not work? Right now, i won't be able to check this on my end. But i suppose disabling that should have work.

      let audioTrack = factory.audioTrack(withTrackId: "RTCaS0")
            localStream.addAudioTrack(audioTrack)
            audioTrack.isEnabled = true

You need to use audio track present in here.

ryandailey100 commented 5 years ago

As per our emails, I was finally able to get mute working. For anyone wondering how this was achieved, I had to edit the RTCClient class to keep a reference of instance of the initial audioTrack added to localStream and just update isEnabled property instead of adding track again. Thanks again @Ankit-Aggarwal for recommending this solution!