diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-04-29 05:49:15 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-04-29 05:49:15 +0300 |
commit | 678ccd8ffea3578a9d7e186af098db4af413cbfb (patch) | |
tree | 44cee70ebf8056e0f6458948abe534a2f4e8bb4f | |
parent | ca478a5adf66aafb9764125b7a466e96dfa27373 (diff) |
Disconnect received videos by toggling the video directly in Janusdisconnect-received-videos-by-toggling-the-video-directly-in-janus
Originally the HPB required a renegotiation to block the received
videos. However, besides the standard WebRTC way, Janus also supports
directly toggling on and off the video without any renegotiation. This
is now exposed by the signaling server through the "selectStream"
message, so the video is now blocked using that approach instead.
The previous code to block the video using a renegotiation is still
kept, though, as it could be used without HPB once all the clients
support renegotiations.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | src/utils/webrtc/simplewebrtc/peer.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/webrtc/simplewebrtc/peer.js b/src/utils/webrtc/simplewebrtc/peer.js index 6b0a987a8..784c4eab4 100644 --- a/src/utils/webrtc/simplewebrtc/peer.js +++ b/src/utils/webrtc/simplewebrtc/peer.js @@ -865,6 +865,19 @@ Peer.prototype.setRemoteVideoBlocked = function(remoteVideoBlocked) { return } + // If the HPB is used the remote video can be blocked through a standard + // WebRTC renegotiation or by toggling the video directly in Janus. The last + // one is preferred, as it requires less signaling messages to be exchanged + // and, besides that, the browser starts to decode the video faster once + // enabled again. + if (this.receiverOnly && this.parent.config.connection.hasFeature('update-sdp')) { + this.send('selectStream', { + video: !remoteVideoBlocked, + }) + + return + } + this._remoteVideoShouldBeBlocked = remoteVideoBlocked // The "negotiationneeded" event is emitted if needed based on the direction |