fix(conference): early video muted state
If muteVideo is called, before local tracks have been initialized it will be synced up once the tracks are created (or not).
This commit is contained in:
parent
a5f61714bd
commit
6ac23c8086
|
@ -422,6 +422,12 @@ function _connectionFailedHandler(error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
/**
|
||||||
|
* Flag used to delay modification of the muted status of local media tracks
|
||||||
|
* until those are created (or not, but at that point it's certain that
|
||||||
|
* the tracks won't exist).
|
||||||
|
*/
|
||||||
|
_localTracksInitialized: false,
|
||||||
isModerator: false,
|
isModerator: false,
|
||||||
audioMuted: false,
|
audioMuted: false,
|
||||||
videoMuted: false,
|
videoMuted: false,
|
||||||
|
@ -620,6 +626,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
logger.log('initialized with %s local tracks', tracks.length);
|
logger.log('initialized with %s local tracks', tracks.length);
|
||||||
|
this._localTracksInitialized = true;
|
||||||
con.addEventListener(
|
con.addEventListener(
|
||||||
ConnectionEvents.CONNECTION_FAILED,
|
ConnectionEvents.CONNECTION_FAILED,
|
||||||
_connectionFailedHandler);
|
_connectionFailedHandler);
|
||||||
|
@ -711,6 +718,8 @@ export default {
|
||||||
*/
|
*/
|
||||||
toggleAudioMuted(force = false) {
|
toggleAudioMuted(force = false) {
|
||||||
if(!localAudio && force) {
|
if(!localAudio && force) {
|
||||||
|
// NOTE this logic will be adjusted to the same one as for the video
|
||||||
|
// once 'startWithAudioMuted' option is added.
|
||||||
initialAudioMutedState = !initialAudioMutedState;
|
initialAudioMutedState = !initialAudioMutedState;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -723,6 +732,13 @@ export default {
|
||||||
* dialogs in case of media permissions error.
|
* dialogs in case of media permissions error.
|
||||||
*/
|
*/
|
||||||
muteVideo(mute, showUI = true) {
|
muteVideo(mute, showUI = true) {
|
||||||
|
// Not ready to modify track's state yet
|
||||||
|
if (!this._localTracksInitialized) {
|
||||||
|
this.videoMuted = mute;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!localVideo && this.videoMuted && !mute) {
|
if (!localVideo && this.videoMuted && !mute) {
|
||||||
// Try to create local video if there wasn't any.
|
// Try to create local video if there wasn't any.
|
||||||
// This handles the case when user joined with no video
|
// This handles the case when user joined with no video
|
||||||
|
@ -744,6 +760,13 @@ export default {
|
||||||
})
|
})
|
||||||
.then(videoTrack => this.useVideoStream(videoTrack));
|
.then(videoTrack => this.useVideoStream(videoTrack));
|
||||||
} else {
|
} else {
|
||||||
|
// FIXME if localVideo exists and the permissions are blocked
|
||||||
|
// while video muted it will fail to unmute and UI will get out of
|
||||||
|
// sync (the toolbar will show unmuted even though unmute failed).
|
||||||
|
// But for some reason that only happens when toggling off from
|
||||||
|
// the audio only mode - the same scenario works fine from toolbar.
|
||||||
|
// This is very rare corner case and supposedly this will get fixed
|
||||||
|
// once everything goes to react/redux.
|
||||||
muteLocalVideo(mute);
|
muteLocalVideo(mute);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue