auto swap back to webcam after screen share

This commit is contained in:
Ian Ramzy 2020-04-03 00:05:14 -04:00
parent 4c8c7fd37b
commit 124e49947c
1 changed files with 4 additions and 1 deletions

View File

@ -493,7 +493,7 @@ function swap() {
navigator.mediaDevices
.getDisplayMedia({
video: true,
audio: true,
audio: false,
})
.then(function (stream) {
mode = "screen";
@ -524,6 +524,9 @@ function swap() {
function switchStreamHelper(stream) {
let videoTrack = stream.getVideoTracks()[0];
videoTrack.onended = function () {
swap();
};
if (VideoChat.connected) {
const sender = VideoChat.peerConnection.getSenders().find(function (s) {
return s.track.kind === videoTrack.kind;