Skip to content

Commit

Permalink
janus 1.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevaev committed Mar 22, 2024
1 parent 1c212b2 commit 4f8a55d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions web/share/js/kvm/stream_janus.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,31 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
}
},

// Janus 1.x
"onremotetrack": function(changed_track, id, added) {
__logInfo("Got onremotetrack:", changed_track, id, added);
let el = $("stream-video");
if (!el.srcObject) {
el.srcObject = new MediaStream();
}
let stream = el.srcObject;
if (added) {
for (let track of stream.getTracks()) {
if (track.kind === changed_track.kind && track.id !== changed_track.id) {
stream.removeTrack(track);
}
}
stream.addTrack(changed_track);
if (changed_track.kind == "video") {
__sendKeyRequired();
__startInfoInterval();
}
} else {
stream.removeTrack(changed_track);
}
},

// Janus 0.x
"onremotestream": function(stream) {
if (stream === null) {
// https://github.com/pikvm/pikvm/issues/1084
Expand Down

0 comments on commit 4f8a55d

Please sign in to comment.