From 6f7c809b7111f2294e069973f3df34527aa6ce1d Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 25 Apr 2020 15:08:18 +0200 Subject: [PATCH] Unshare screen when stream ends. --- static/sfu.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/sfu.js b/static/sfu.js index 4886d0b..e4f0f30 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -174,6 +174,10 @@ async function setShareMedia() { c.stream = stream; stream.getTracks().forEach(t => { c.pc.addTrack(t, stream); + t.onended = e => { + document.getElementById('sharebox').checked = false; + setShareMedia(); + } }); await setMedia(shareMediaId); }