diff options
author | Maxim Devaev <[email protected]> | 2024-03-23 16:40:50 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-03-23 16:40:50 +0200 |
commit | b23fd2f9f14252c164659bdaa3ed2f461ee0a988 (patch) | |
tree | eb28b82c493e972ee3da1268244fd4ef55a9516d | |
parent | 0980a586e630625e252287237ef818fe44a52097 (diff) |
janus: 0.x and 1.x compatible tracks cleanup
-rw-r--r-- | web/share/js/kvm/stream_janus.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/web/share/js/kvm/stream_janus.js b/web/share/js/kvm/stream_janus.js index 21c91190..2aa067b3 100644 --- a/web/share/js/kvm/stream_janus.js +++ b/web/share/js/kvm/stream_janus.js @@ -123,18 +123,19 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _ }; var __destroyJanus = function() { - if (__handle && __handle.webrtcStuff && __handle.webrtcStuff.remoteStream) { - for (let track of __handle.webrtcStuff.remoteStream.getTracks()) { - track.stop(); - __handle.webrtcStuff.remoteStream.removeTrack(track); - } - __handle.webrtcStuff.remoteStream = null; - } - $("stream-video").srcObject = null; if (__janus !== null) { __janus.destroy(); } __finishJanus(); + let stream = $("stream-video").srcObject; + if (stream) { + for (let track of stream.getTracks()) { + __logInfo("Removing track after destroying Janus:", track); + track.stop(); + stream.removeTrack(track); + } + $("stream-video").srcObject = null; + } }; var __attachJanus = function() { |