RTCMultiConnection
RTCMultiConnection copied to clipboard
Webcam, then switch to screenshare with replaceTrack()
I have taken basic example for RTCConnection from your getting started. I am using screenId.js and RTCMulticonnection.js
I am trying to replace the webcam using connection.replaceTrack({screen: true, oneway: true});
But when I do this, I still see the webcam, but now screenshare is added as well.
How can I replace it? Or am i not understanding the replaceTrack API properly?
replaceTrack API are/seems available only on Firefox.
var screenTrack = screenStream.getVideoTracks()[0];
connection.getAllParticipants().forEach(function(uid) {
var peer = connection.peers[uid].peer;
var sendes = peer.getSenders();
senders.forEach(function(sender) {
if(sender.track instanceof AudioStreamTrack) return; // skip audio
sender.replaceTrack( screenTrack );
});
});
applyConstraints API also requires Firefox.
cannot switch webcam to screen share!!!