Browse Source

fix(presenter): Broken stop SS + presenter.

Fixes an issue - not able to stop the screen sharing in presenter
mode from the screen sharing button.
master
Hristo Terezov 2 years ago
parent
commit
aee94ad6fb
1 changed files with 19 additions and 5 deletions
  1. 19
    5
      conference.js

+ 19
- 5
conference.js View File

@@ -1650,12 +1650,26 @@ export default {
1650 1650
         let promise = _prevMutePresenterVideo = _prevMutePresenterVideo.then(() => {
1651 1651
             // mute the presenter track if it exists.
1652 1652
             if (this.localPresenterVideo) {
1653
-                APP.store.dispatch(setVideoMuted(true, MEDIA_TYPE.PRESENTER));
1653
+                return (
1654
+                    this.localPresenterVideo.dispose().then(() => {
1655
+                        APP.store.dispatch(trackRemoved(this.localPresenterVideo));
1656
+                        this.localPresenterVideo = null;
1657
+                    })
1658
+                    .then(() => {
1654 1659
 
1655
-                return this.localPresenterVideo.dispose().then(() => {
1656
-                    APP.store.dispatch(trackRemoved(this.localPresenterVideo));
1657
-                    this.localPresenterVideo = null;
1658
-                });
1660
+                        // This is needed only for setting the correct muted state in features/base/media.
1661
+                        // NOTE: It is important to be executed after we have disposed and removed the presenter track.
1662
+                        // This way all the side effects won't be executed and we won't start additional O/A cycle for
1663
+                        // replacing the track with video with the one without video. This O/A cycle is not needed since
1664
+                        // we are trying to destroy all tracks. Also due to the current async nature of muting the
1665
+                        // presenter, the final removal of the screen sharing track (see the code at the end of the
1666
+                        // function) can be executed between the removal of the stream with video and adding the
1667
+                        // original screen sharing stream to the peer connection. This will lead to a failure to remove
1668
+                        // the screen sharing track, compromising the screen sharing state in jitsi-meet and the user
1669
+                        // won't be able to turn off the screen sharing.
1670
+                        APP.store.dispatch(setVideoMuted(true, MEDIA_TYPE.PRESENTER));
1671
+                    })
1672
+                );
1659 1673
             }
1660 1674
         });
1661 1675
 

Loading…
Cancel
Save