Alon Gubkin
Alon Gubkin

Reputation: 57149

How to implement mute with PhoneRTC?

I managed to create a video chat in my Cordova app using PhoneRTC. Now, I want to add a button that toggles mute on the local microphone output.

How can I do that?

Upvotes: 0

Views: 600

Answers (2)

jesup
jesup

Reputation: 6982

You don't want to renegotiate to implement muting.

You want to get the audio (and maybe video) mediastreamtrack, and do track.enabled = false. That makes it silence (audio) or black (video).

Renegotiation requires at least several RTT to complete and can fail (and Firefox doesn't support it yet, requiring creating a new PeerConnection to replace the old one).

Upvotes: 0

Alon Gubkin
Alon Gubkin

Reputation: 57149

Use Session.renegotiate.

For example:

session.streams.audio = false;
session.renegotiate();

Upvotes: 1

Related Questions