My RTC session was started with text only. And video is added by user when needed (renegotiation)
navigator.getUserMedia({ video: true, audio: false }, function (myStream) { localVideo[0].srcObject = myStream; myConn.addStream(myStream); }, function (error) { console.log(error); }); When user do not need the video session anymore, I remove using:
var tracks = localVideo[0].srcObject.getTracks(); tracks.forEach(function (t) { t.stop(); }); myConn.removeStream(localVideo[0].srcObject); localVideo[0].srcObject = null; Everything is working fine, until I try to add the video again I noticed that the createOffer() request size is getting larger and larger.
Seems to me that WebRTC didn't forget about the previous stream, and is adding to the offer again and again. Or maybe my way of removing a video stream / track is wrong?
https://stackoverflow.com/questions/66512241/webrtc-what-is-the-correct-way-to-removestream-and-addstream-again March 07, 2021 at 08:58AM
没有评论:
发表评论