I had a problem trying to change the camera in real time. It works for local video, but the remote person cannot see the new camera and still sees the old one. I tried to stop the thread and restart again, but still did not work. This is just part of my code. I searched everywhere and I cannot find a solution. Can someone help me?
function init() {
getUserMedia(constraints, connect, fail);
}
$(".webcam-devices").on('change', function() {
var deviceID = this.value;
constraints.video = {
optional: [{
sourceId: deviceID
}]
};
stream.getTracks().forEach(function (track) { track.stop(); });
init();
});
source
share