WebRTC pause and resume stream

前端 未结 2 791
梦谈多话
梦谈多话 2021-02-05 08:58

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()

2条回答
  •  不思量自难忘°
    2021-02-05 09:25

    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

提交回复
热议问题