summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-03-22 23:11:45 +0200
committerMaxim Devaev <[email protected]>2024-03-22 23:11:45 +0200
commit4f8a55d9e06a3b303f6f2e36f1f3f9e174e10246 (patch)
tree8191685457d65cf4e3cc1b05545e688aacd6b837
parent1c212b22bf7de747fd2ff256d2d7e7032145f35c (diff)
janus 1.x compatibility
-rw-r--r--web/share/js/kvm/stream_janus.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/web/share/js/kvm/stream_janus.js b/web/share/js/kvm/stream_janus.js
index e7303f78..9ae7bc65 100644
--- a/web/share/js/kvm/stream_janus.js
+++ b/web/share/js/kvm/stream_janus.js
@@ -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