Parcourir la 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 il y a 5 ans
Parent
révision
da68b9882d
2 fichiers modifiés avec 9 ajouts et 13 suppressions
  1. 3
    3
      conference.js
  2. 6
    10
      react/features/screenshot-capture/actions.js

+ 3
- 3
conference.js Voir le fichier

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

+ 6
- 10
react/features/screenshot-capture/actions.js Voir le fichier

@@ -34,17 +34,13 @@ export function toggleScreenshotCaptureEffect(enabled: boolean) {
34 34
         if (state['features/screenshot-capture'].capturesEnabled !== enabled) {
35 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 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 46
         return Promise.resolve();

Chargement…
Annuler
Enregistrer