Browse Source

fix(screenshot-capture): Do not switch streams at the conference level.

This effect doesn't modify the media stream, so its safe to start/stop effect and not apply it on the JitsiLocalTrack. This way we can make sure that this effect is not switched out when presenter effect is applied.
master
Jaya Allamsetty 5 years ago
parent
commit
da68b9882d
2 changed files with 9 additions and 13 deletions
  1. 3
    3
      conference.js
  2. 6
    10
      react/features/screenshot-capture/actions.js

+ 3
- 3
conference.js View File

1426
         }
1426
         }
1427
 
1427
 
1428
         this._stopProxyConnection();
1428
         this._stopProxyConnection();
1429
+        if (config.enableScreenshotCapture) {
1430
+            APP.store.dispatch(toggleScreenshotCaptureEffect(false));
1431
+        }
1429
 
1432
 
1430
         // It can happen that presenter GUM is in progress while screensharing is being turned off. Here it needs to
1433
         // It can happen that presenter GUM is in progress while screensharing is being turned off. Here it needs to
1431
         // wait for that GUM to be resolved in order to prevent leaking the presenter track(this.localPresenterVideo
1434
         // wait for that GUM to be resolved in order to prevent leaking the presenter track(this.localPresenterVideo
1461
         } else {
1464
         } else {
1462
             promise = promise.then(() => this.useVideoStream(null));
1465
             promise = promise.then(() => this.useVideoStream(null));
1463
         }
1466
         }
1464
-        if (config.enableScreenshotCapture) {
1465
-            APP.store.dispatch(toggleScreenshotCaptureEffect(false));
1466
-        }
1467
 
1467
 
1468
         return promise.then(
1468
         return promise.then(
1469
             () => {
1469
             () => {

+ 6
- 10
react/features/screenshot-capture/actions.js View File

34
         if (state['features/screenshot-capture'].capturesEnabled !== enabled) {
34
         if (state['features/screenshot-capture'].capturesEnabled !== enabled) {
35
             const { jitsiTrack } = getLocalVideoTrack(state['features/base/tracks']);
35
             const { jitsiTrack } = getLocalVideoTrack(state['features/base/tracks']);
36
 
36
 
37
+            // Screenshot capture effect doesn't return a modified stream. Therefore, we don't have to
38
+            // switch the stream at the conference level, starting/stopping the effect will suffice here.
37
             return createScreenshotCaptureEffect(state)
39
             return createScreenshotCaptureEffect(state)
38
-                .then(effect =>
39
-                    jitsiTrack.setEffect(enabled ? effect : undefined)
40
-                        .then(() => {
41
-                            dispatch(setScreenshotCapture(enabled));
42
-                        })
43
-                        .catch(() => {
44
-                            dispatch(setScreenshotCapture(!enabled));
45
-                        })
46
-                )
47
-                .catch(() => dispatch(setScreenshotCapture(false)));
40
+                .then(effect => {
41
+                    enabled ? effect.startEffect(jitsiTrack.getOriginalStream()) : effect.stopEffect();
42
+                    dispatch(setScreenshotCapture(enabled));
43
+                });
48
         }
44
         }
49
 
45
 
50
         return Promise.resolve();
46
         return Promise.resolve();

Loading…
Cancel
Save