From 9bd093e78cebfd0bd1c7a1e3461960e486346406 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Wed, 29 Apr 2020 01:22:39 +0200 Subject: [PATCH] Stop tracks before closing stream. Otherwise the camera status light stays on. --- static/sfu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/sfu.js b/static/sfu.js index ee2efb7..7bf69b3 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -54,6 +54,12 @@ Connection.prototype.close = function(sendit) { while(this.timers.length > 0) clearInterval(this.timers.pop()); + this.stream.getTracks().forEach(t => { + try { + t.stop(); + } catch(e) { + } + }); this.pc.close(); if(sendit) {