diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-03-31 09:18:44 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-03-31 18:09:57 +0300 |
commit | c39e3a00333da82bdf16c9e5cbed49a06b45baec (patch) | |
tree | cbcf594f3f356b522e821516b1ad412d39bab930 /src | |
parent | 0cc75c5b0973976f6ba1827c085f8d43d91b6b59 (diff) |
Disable media when disallowed
If publishing media is disallowed now the media is also disabled to
ensure that, if the media is then allowed again, it will not be
unexpectedly enabled.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/webrtc/models/LocalMediaModel.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/webrtc/models/LocalMediaModel.js b/src/utils/webrtc/models/LocalMediaModel.js index f74eb0767..7994fa242 100644 --- a/src/utils/webrtc/models/LocalMediaModel.js +++ b/src/utils/webrtc/models/LocalMediaModel.js @@ -54,11 +54,13 @@ export default function LocalMediaModel() { this._handleLocalStreamChangedBound = this._handleLocalStreamChanged.bind(this) this._handleLocalTrackEnabledChangedBound = this._handleLocalTrackEnabledChanged.bind(this) this._handleLocalStreamStoppedBound = this._handleLocalStreamStopped.bind(this) + this._handleAudioDisallowedBound = this._handleAudioDisallowed.bind(this) this._handleVolumeChangeBound = this._handleVolumeChange.bind(this) this._handleSpeakingBound = this._handleSpeaking.bind(this) this._handleStoppedSpeakingBound = this._handleStoppedSpeaking.bind(this) this._handleSpeakingWhileMutedBound = this._handleSpeakingWhileMuted.bind(this) this._handleStoppedSpeakingWhileMutedBound = this._handleStoppedSpeakingWhileMuted.bind(this) + this._handleVideoDisallowedBound = this._handleVideoDisallowed.bind(this) this._handleVirtualBackgroundLoadFailedBound = this._handleVirtualBackgroundLoadFailed.bind(this) this._handleVirtualBackgroundOnBound = this._handleVirtualBackgroundOn.bind(this) this._handleVirtualBackgroundOffBound = this._handleVirtualBackgroundOff.bind(this) @@ -96,11 +98,13 @@ LocalMediaModel.prototype = { this._webRtc.webrtc.off('localStreamChanged', this._handleLocalStreamChangedBound) this._webRtc.webrtc.off('localTrackEnabledChanged', this._handleLocalTrackEnabledChangedBound) this._webRtc.webrtc.off('localStreamStopped', this._handleLocalStreamStoppedBound) + this._webRtc.webrtc.off('audioDisallowed', this._handleAudioDisallowedBound) this._webRtc.webrtc.off('volumeChange', this._handleVolumeChangeBound) this._webRtc.webrtc.off('speaking', this._handleSpeakingBound) this._webRtc.webrtc.off('stoppedSpeaking', this._handleStoppedSpeakingBound) this._webRtc.webrtc.off('speakingWhileMuted', this._handleSpeakingWhileMutedBound) this._webRtc.webrtc.off('stoppedSpeakingWhileMuted', this._handleStoppedSpeakingWhileMutedBound) + this._webRtc.webrtc.off('videoDisallowed', this._handleVideoDisallowedBound) this._webRtc.webrtc.off('virtualBackgroundLoadFailed', this._handleVirtualBackgroundLoadFailedBound) this._webRtc.webrtc.off('virtualBackgroundOn', this._handleVirtualBackgroundOnBound) this._webRtc.webrtc.off('virtualBackgroundOff', this._handleVirtualBackgroundOffBound) @@ -130,11 +134,13 @@ LocalMediaModel.prototype = { this._webRtc.webrtc.on('localStreamChanged', this._handleLocalStreamChangedBound) this._webRtc.webrtc.on('localTrackEnabledChanged', this._handleLocalTrackEnabledChangedBound) this._webRtc.webrtc.on('localStreamStopped', this._handleLocalStreamStoppedBound) + this._webRtc.webrtc.on('audioDisallowed', this._handleAudioDisallowedBound) this._webRtc.webrtc.on('volumeChange', this._handleVolumeChangeBound) this._webRtc.webrtc.on('speaking', this._handleSpeakingBound) this._webRtc.webrtc.on('stoppedSpeaking', this._handleStoppedSpeakingBound) this._webRtc.webrtc.on('speakingWhileMuted', this._handleSpeakingWhileMutedBound) this._webRtc.webrtc.on('stoppedSpeakingWhileMuted', this._handleStoppedSpeakingWhileMutedBound) + this._webRtc.webrtc.on('videoDisallowed', this._handleVideoDisallowedBound) this._webRtc.webrtc.on('virtualBackgroundLoadFailed', this._handleVirtualBackgroundLoadFailedBound) this._webRtc.webrtc.on('virtualBackgroundOn', this._handleVirtualBackgroundOnBound) this._webRtc.webrtc.on('virtualBackgroundOff', this._handleVirtualBackgroundOffBound) @@ -244,6 +250,10 @@ LocalMediaModel.prototype = { this.set('videoAvailable', false) }, + _handleAudioDisallowed() { + this.disableAudio() + }, + _handleVolumeChange(currentVolume, volumeThreshold) { if (!this.get('audioAvailable')) { return @@ -285,6 +295,10 @@ LocalMediaModel.prototype = { this.set('speakingWhileMuted', false) }, + _handleVideoDisallowed() { + this.disableVideo() + }, + _handleVirtualBackgroundLoadFailed() { this.set('virtualBackgroundAvailable', false) }, |