1
Fork 0

Remove streamed video when it finishes.

This commit is contained in:
Juliusz Chroboczek 2020-11-29 22:16:28 +01:00
parent e2a79e24a1
commit 3a86157f15
1 changed files with 8 additions and 1 deletions

View File

@ -926,8 +926,15 @@ async function addFileMedia(file) {
}); });
if(sender) { if(sender) {
c.pc.removeTrack(sender) c.pc.removeTrack(sender)
} else } else {
console.warn('Removing unknown track'); console.warn('Removing unknown track');
}
if(Object.keys(c.labels).length === 0) {
stream.onaddtrack = null;
stream.onremovetrack == null;
delUpMedia(c);
}
}; };
setMedia(c, true, video); setMedia(c, true, video);
video.play(); video.play();