diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-03-11 15:00:35 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-03-11 15:00:35 +0300 |
commit | 1eaf569402e0685bcd5f0f35dba5f9fc64a42bca (patch) | |
tree | f2ea117908a013c1ff3095e0e513d5181dbd9116 /src/utils | |
parent | 951d0828d195fa12537eb68a59c1722d94414f91 (diff) |
Set initial media state based on the current tracks
This should not make any difference, as the configuration reflects the
current tracks, but it makes it more consistent with
"_updateMediaAvailability()" and prepares it for upcoming changes.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/webrtc/models/LocalMediaModel.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/webrtc/models/LocalMediaModel.js b/src/utils/webrtc/models/LocalMediaModel.js index 3f87eb8c2..2771e9616 100644 --- a/src/utils/webrtc/models/LocalMediaModel.js +++ b/src/utils/webrtc/models/LocalMediaModel.js @@ -172,7 +172,7 @@ LocalMediaModel.prototype = { this.set('token', store.getters.getToken()) - this._setInitialMediaState(configuration) + this._setInitialMediaState(localStream) }, _handleLocalStreamRequestFailedRetryNoVideo(constraints, error) { @@ -186,11 +186,11 @@ LocalMediaModel.prototype = { _handleLocalStreamRequestFailed() { this.set('localStream', null) - this._setInitialMediaState({ audio: false, video: false }) + this._setInitialMediaState(null) }, - _setInitialMediaState(configuration) { - if (configuration.audio !== false) { + _setInitialMediaState(localStream) { + if (localStream && localStream.getAudioTracks().length > 0) { this.set('audioAvailable', true) if (this.get('audioEnabled')) { this.enableAudio() @@ -202,7 +202,7 @@ LocalMediaModel.prototype = { this.set('audioAvailable', false) } - if (configuration.video !== false) { + if (localStream && localStream.getVideoTracks().length > 0) { this.set('videoAvailable', true) if (this.get('videoEnabled')) { this.enableVideo() |