janus: 0.x and 1.x compatible tracks cleanup

This commit is contained in:
Maxim Devaev 2024-03-23 16:40:50 +02:00
parent 0980a586e6
commit b23fd2f9f1

View File

@ -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() {