diff options
author | Sergey Radionov <[email protected]> | 2024-03-11 13:37:23 +0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-11 08:37:23 +0200 |
commit | 6b0f94c78d957359e695e231800d1ddade7706e0 (patch) | |
tree | 51b1bbd15b11ab1e0f1cee1b5fd65d3df84d893b /web/share/js/kvm/stream_janus.js | |
parent | 6ad14ad833eca8eba7de3039bcac8e9973b3a32c (diff) |
On bad network conditions `disconnected` can happen periodically (#161)
but it doesn't mean channel is already broken.
It's better wait `failed` state since `disconnected`
can be changed to `connected` at any moment.
Also fixes reconnect on Firefox.
Diffstat (limited to 'web/share/js/kvm/stream_janus.js')
-rw-r--r-- | web/share/js/kvm/stream_janus.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/web/share/js/kvm/stream_janus.js b/web/share/js/kvm/stream_janus.js index 05fdc128..eff7b18b 100644 --- a/web/share/js/kvm/stream_janus.js +++ b/web/share/js/kvm/stream_janus.js @@ -156,6 +156,13 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __allow_aud __destroyJanus(); }, + "peerConnectionState": function(state) { + __logInfo("Peer connection state changed to", state); + if (state === "failed") { + __destroyJanus(); + } + }, + "iceState": function(state) { __logInfo("ICE state changed to", state); // Если раскомментировать, то он начнет дрючить соединение, @@ -245,12 +252,10 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __allow_aud } if (!has_video && __isOnline()) { - // Найдено в Windows 11 и Chrome/Edge. - // При перезагрузке целевого хоста браузер мьютит трек, - // приходит стрим без видеотрека и всё умирает. - // Связь должна как-то сама восстанавливаться, - // но этого почему-то не происходит. Костыль решает проблему. - __destroyJanus(); + // Chrome sends `muted` notifiation for tracks in `disconnected` ICE state + // and Janus.js just removes muted track from list of available tracks. + // But track still exists actually so it's safe to just ignore that case. + return; } _Janus.attachMediaStream($("stream-video"), stream); |