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 (external-api): fix notify video mute changed when presenting

hmuresanb998d80ee37d
diff --git a/conference.js b/conference.js
index 22a604f210..90dea30257 100644
--- a/conference.js
+++ b/conference.js
@@ -739,7 +739,7 @@ export default {
}
if (!tracks.find(t => t.isVideoTrack())) {
- this.setVideoMuteStatus(true);
+ this.setVideoMuteStatus();
}
if (config.iAmRecorder) {
@@ -993,7 +993,7 @@ export default {
// This will only modify base/media.video.muted which is then synced
// up with the track at the end of local tracks initialization.
muteLocalVideo(mute);
- this.setVideoMuteStatus(mute);
+ this.setVideoMuteStatus();
return;
} else if (this.isLocalVideoMuted() === mute) {
@@ -1402,7 +1402,7 @@ export default {
.then(() => {
this.localVideo = newTrack;
this._setSharingScreen(newTrack);
- this.setVideoMuteStatus(this.isLocalVideoMuted());
+ this.setVideoMuteStatus();
})
.then(resolve)
.catch(error => {
@@ -1821,7 +1821,7 @@ export default {
try {
await this.localVideo.setEffect(effect);
APP.store.dispatch(setVideoMuted(mute, MEDIA_TYPE.PRESENTER));
- this.setVideoMuteStatus(mute);
+ this.setVideoMuteStatus();
} catch (err) {
logger.error('Failed to apply the Presenter effect', err);
}
@@ -2303,7 +2303,7 @@ export default {
return this._createPresenterStreamEffect(height, cameraDeviceId)
.then(effect => this.localVideo.setEffect(effect))
.then(() => {
- this.setVideoMuteStatus(false);
+ this.setVideoMuteStatus();
logger.log('Switched local video device while screen sharing and the video is unmuted');
this._updateVideoDeviceId();
})
@@ -3105,12 +3105,9 @@ export default {
/**
* Sets the video muted status.
- *
- * @param {boolean} muted - New muted status.
*/
- setVideoMuteStatus(muted) {
+ setVideoMuteStatus() {
APP.UI.setVideoMuted(this.getMyUserId());
- APP.API.notifyVideoMutedStatusChanged(muted);
},
/**
diff --git a/react/features/base/tracks/middleware.js b/react/features/base/tracks/middleware.js
index b0b6800f57..acb8483c2c 100644
--- a/react/features/base/tracks/middleware.js
+++ b/react/features/base/tracks/middleware.js
@@ -159,7 +159,7 @@ MiddlewareRegistry.register(store => next => action => {
if (jitsiTrack.type === MEDIA_TYPE.PRESENTER) {
APP.conference.mutePresenter(muted);
} else if (jitsiTrack.isLocal()) {
- APP.conference.setVideoMuteStatus(muted);
+ APP.conference.setVideoMuteStatus();
} else {
APP.UI.setVideoMuted(participantID);
}
diff --git a/react/features/base/tracks/subscriber.js b/react/features/base/tracks/subscriber.js
index 0fb7b7ccb3..1d4a10d4e1 100644
--- a/react/features/base/tracks/subscriber.js
+++ b/react/features/base/tracks/subscriber.js
@@ -4,6 +4,8 @@ import _ from 'lodash';
import { StateListenerRegistry } from '../../base/redux';
+import { isLocalCameraTrackMuted } from './functions';
+
declare var APP: Object;
/**
@@ -22,3 +24,20 @@ StateListenerRegistry.register(
}
}
);
+
+
+/**
+ * Notifies when the local video mute state changes.
+ */
+StateListenerRegistry.register(
+ /* selector */ state => isLocalCameraTrackMuted(state['features/base/tracks']),
+ /* listener */ (muted, store, previousMuted) => {
+ if (typeof APP !== 'object') {
+ return;
+ }
+
+ if (muted !== previousMuted) {
+ APP.API.notifyVideoMutedStatusChanged(muted);
+ }
+ }
+);