Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(video-mute) prevent multiple camera track creation

William Liang83dfb67f2310
diff --git a/conference.js b/conference.js
index 6374507f5a..bb94002084 100644
--- a/conference.js
+++ b/conference.js
@@ -459,6 +459,11 @@ export default {
*/
_localTracksInitialized: false,
+ /**
+ * Flag used to prevent the creation of another local video track in this.muteVideo if one is already in progress.
+ */
+ isCreatingLocalTrack: false,
+
isSharingScreen: false,
/**
@@ -1028,11 +1033,13 @@ export default {
const localVideo = getLocalJitsiVideoTrack(APP.store.getState());
- if (!localVideo && !mute) {
+ if (!localVideo && !mute && !this.isCreatingLocalTrack) {
const maybeShowErrorDialog = error => {
showUI && APP.store.dispatch(notifyCameraError(error));
};
+ this.isCreatingLocalTrack = true;
+
// Try to create local video if there wasn't any.
// This handles the case when user joined with no video
// (dismissed screen sharing screen or in audio only mode), but
@@ -1054,6 +1061,9 @@ export default {
logger.debug(`muteVideo: calling useVideoStream for track: ${videoTrack}`);
return this.useVideoStream(videoTrack);
+ })
+ .finally(() => {
+ this.isCreatingLocalTrack = false;
});
} else {
// FIXME show error dialog if it fails (should be handled by react)