I am trying to use WebRTC to build a web application that needs to pause/resume the video/audio stream when some events trigger. I have tried the getTracks()[0].stop()
You should try using renegotiation, I believe the difference still exists how it is done in chrome and firefox:
In chrome, you just call addStream
or removeStream
on the PeerConnection
object to add/ remove the stream, then create and exchange sdp
.
In firefox, there is no direct removeStream
, you need to use RTCRtpSender and addTrack
and removeTrack
methods, you can take a look at this question