Browse Source

fix (external-api): fix notify video mute changed when presenting

- small refactor to trigger `notifyVideoMutedStatusChanged` correctly when participant is presenting
master
hmuresan 4 years ago
parent
commit
b998d80ee3

+ 6
- 9
conference.js View File

739
         }
739
         }
740
 
740
 
741
         if (!tracks.find(t => t.isVideoTrack())) {
741
         if (!tracks.find(t => t.isVideoTrack())) {
742
-            this.setVideoMuteStatus(true);
742
+            this.setVideoMuteStatus();
743
         }
743
         }
744
 
744
 
745
         if (config.iAmRecorder) {
745
         if (config.iAmRecorder) {
993
             // This will only modify base/media.video.muted which is then synced
993
             // This will only modify base/media.video.muted which is then synced
994
             // up with the track at the end of local tracks initialization.
994
             // up with the track at the end of local tracks initialization.
995
             muteLocalVideo(mute);
995
             muteLocalVideo(mute);
996
-            this.setVideoMuteStatus(mute);
996
+            this.setVideoMuteStatus();
997
 
997
 
998
             return;
998
             return;
999
         } else if (this.isLocalVideoMuted() === mute) {
999
         } else if (this.isLocalVideoMuted() === mute) {
1402
                     .then(() => {
1402
                     .then(() => {
1403
                         this.localVideo = newTrack;
1403
                         this.localVideo = newTrack;
1404
                         this._setSharingScreen(newTrack);
1404
                         this._setSharingScreen(newTrack);
1405
-                        this.setVideoMuteStatus(this.isLocalVideoMuted());
1405
+                        this.setVideoMuteStatus();
1406
                     })
1406
                     })
1407
                     .then(resolve)
1407
                     .then(resolve)
1408
                     .catch(error => {
1408
                     .catch(error => {
1821
             try {
1821
             try {
1822
                 await this.localVideo.setEffect(effect);
1822
                 await this.localVideo.setEffect(effect);
1823
                 APP.store.dispatch(setVideoMuted(mute, MEDIA_TYPE.PRESENTER));
1823
                 APP.store.dispatch(setVideoMuted(mute, MEDIA_TYPE.PRESENTER));
1824
-                this.setVideoMuteStatus(mute);
1824
+                this.setVideoMuteStatus();
1825
             } catch (err) {
1825
             } catch (err) {
1826
                 logger.error('Failed to apply the Presenter effect', err);
1826
                 logger.error('Failed to apply the Presenter effect', err);
1827
             }
1827
             }
2303
                     return this._createPresenterStreamEffect(height, cameraDeviceId)
2303
                     return this._createPresenterStreamEffect(height, cameraDeviceId)
2304
                         .then(effect => this.localVideo.setEffect(effect))
2304
                         .then(effect => this.localVideo.setEffect(effect))
2305
                         .then(() => {
2305
                         .then(() => {
2306
-                            this.setVideoMuteStatus(false);
2306
+                            this.setVideoMuteStatus();
2307
                             logger.log('Switched local video device while screen sharing and the video is unmuted');
2307
                             logger.log('Switched local video device while screen sharing and the video is unmuted');
2308
                             this._updateVideoDeviceId();
2308
                             this._updateVideoDeviceId();
2309
                         })
2309
                         })
3105
 
3105
 
3106
     /**
3106
     /**
3107
      * Sets the video muted status.
3107
      * Sets the video muted status.
3108
-     *
3109
-     * @param {boolean} muted - New muted status.
3110
      */
3108
      */
3111
-    setVideoMuteStatus(muted) {
3109
+    setVideoMuteStatus() {
3112
         APP.UI.setVideoMuted(this.getMyUserId());
3110
         APP.UI.setVideoMuted(this.getMyUserId());
3113
-        APP.API.notifyVideoMutedStatusChanged(muted);
3114
     },
3111
     },
3115
 
3112
 
3116
     /**
3113
     /**

+ 1
- 1
react/features/base/tracks/middleware.js View File

159
                 if (jitsiTrack.type === MEDIA_TYPE.PRESENTER) {
159
                 if (jitsiTrack.type === MEDIA_TYPE.PRESENTER) {
160
                     APP.conference.mutePresenter(muted);
160
                     APP.conference.mutePresenter(muted);
161
                 } else if (jitsiTrack.isLocal()) {
161
                 } else if (jitsiTrack.isLocal()) {
162
-                    APP.conference.setVideoMuteStatus(muted);
162
+                    APP.conference.setVideoMuteStatus();
163
                 } else {
163
                 } else {
164
                     APP.UI.setVideoMuted(participantID);
164
                     APP.UI.setVideoMuted(participantID);
165
                 }
165
                 }

+ 19
- 0
react/features/base/tracks/subscriber.js View File

4
 
4
 
5
 import { StateListenerRegistry } from '../../base/redux';
5
 import { StateListenerRegistry } from '../../base/redux';
6
 
6
 
7
+import { isLocalCameraTrackMuted } from './functions';
8
+
7
 declare var APP: Object;
9
 declare var APP: Object;
8
 
10
 
9
 /**
11
 /**
22
         }
24
         }
23
     }
25
     }
24
 );
26
 );
27
+
28
+
29
+/**
30
+ * Notifies when the local video mute state changes.
31
+ */
32
+StateListenerRegistry.register(
33
+    /* selector */ state => isLocalCameraTrackMuted(state['features/base/tracks']),
34
+    /* listener */ (muted, store, previousMuted) => {
35
+        if (typeof APP !== 'object') {
36
+            return;
37
+        }
38
+
39
+        if (muted !== previousMuted) {
40
+            APP.API.notifyVideoMutedStatusChanged(muted);
41
+        }
42
+    }
43
+);

Loading…
Cancel
Save