diff options
author | Maxim Devaev <[email protected]> | 2023-07-23 22:15:15 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2023-07-23 22:15:15 +0300 |
commit | dfa3354978adfce8389a9e076b7475ec278ae154 (patch) | |
tree | 311ceab717464a10b233c3e6e269a2827bd7da64 | |
parent | 4f21aae0cefe709aeabbad5c4b851223a0b33d56 (diff) |
pikvm/pikvm#1057: web: fixed onremotestream handler for active=false
-rw-r--r-- | web/share/js/kvm/stream_janus.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/web/share/js/kvm/stream_janus.js b/web/share/js/kvm/stream_janus.js index 13c32244..74106e85 100644 --- a/web/share/js/kvm/stream_janus.js +++ b/web/share/js/kvm/stream_janus.js @@ -220,19 +220,26 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __allow_aud }, "onremotestream": function(stream) { - __logInfo("Got a remote stream:", stream); - _Janus.attachMediaStream($("stream-video"), stream); - __sendKeyRequired(); - __startInfoInterval(); - // FIXME: Задержка уменьшается, но начинаются заикания на кейфреймах. - // - https://github.com/Glimesh/janus-ftl-plugin/issues/101 - /*if (__handle && __handle.webrtcStuff && __handle.webrtcStuff.pc) { - for (let receiver of __handle.webrtcStuff.pc.getReceivers()) { - if (receiver.track && receiver.track.kind === "video" && receiver.playoutDelayHint !== undefined) { - receiver.playoutDelayHint = 0; + __logInfo("Got a remote stream changes:", stream); + if (stream.active) { + _Janus.attachMediaStream($("stream-video"), stream); + __sendKeyRequired(); + __startInfoInterval(); + // FIXME: Задержка уменьшается, но начинаются заикания на кейфреймах. + // - https://github.com/Glimesh/janus-ftl-plugin/issues/101 + /*if (__handle && __handle.webrtcStuff && __handle.webrtcStuff.pc) { + for (let receiver of __handle.webrtcStuff.pc.getReceivers()) { + if (receiver.track && receiver.track.kind === "video" && receiver.playoutDelayHint !== undefined) { + receiver.playoutDelayHint = 0; + } } - } - }*/ + }*/ + } else { + // В каких-то случаях стрим может иметь флаг active=false, + // но при этом янус работает. Хз почему. + // - https://github.com/pikvm/pikvm/issues/1057 + __destroyJanus(); + } }, "oncleanup": function() { |