WebRTC: Renegotiation in firefox -


according this article, re-negotiation implemented in firefox v38 , can add remove streams same peerconnections without creating new ones, unable find working demos support claim, , when tried it, 2 users chating in video mode, changing 1 of stream audio, error:

notsupportederror: removestream not yet implemented

this tells same, this tells renegotiation events supported, isn't removestream key part of renegotiation? using firefox version 39 in windows 7. confused, renegotiation not yet supported in firefox, right?

try using replacetrack individual tracks, instead of replacing entire stream. example assumes have peer connection pc1 , new stream newstream replace on it. senders, , replace tracks appropriate tracks new stream. working sample here.

promise.all(pc1.getsenders().map(sender =>   sender.replacetrack((sender.track.kind == "audio")?                       newstream.getaudiotracks()[0] :                       newstream.getvideotracks()[0]))) .then(() => log("flip!")) .catch(failed); 

also note this, first link:

function screenshare() {     let screenconstraints = {video: {mediasource: "screen"}};      navigator.mediadevices.getusermedia(screenconstraints)     .then(stream) {         stream.gettracks().foreach(track) {             screenstream = stream;             screensenders.push(pc1.addtrack(track, stream));         });     }); } 

notice example calls pc1.addtrack not pc1.addstream

and in same in reverse, removing - pc1.removetrack:

function stopscreenshare() {     screenstream.stop();     screensenders.foreach(sender) {         pc1.removetrack(sender);     }); } 

Comments