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(screenshot-capture): Do not switch streams at the conference level.

Jaya Allamsettyda68b9882dbe
diff --git a/conference.js b/conference.js
index a592dadfce..4a9ba92ff7 100644
--- a/conference.js
+++ b/conference.js
@@ -1426,6 +1426,9 @@ export default {
}
this._stopProxyConnection();
+ if (config.enableScreenshotCapture) {
+ APP.store.dispatch(toggleScreenshotCaptureEffect(false));
+ }
// It can happen that presenter GUM is in progress while screensharing is being turned off. Here it needs to
// wait for that GUM to be resolved in order to prevent leaking the presenter track(this.localPresenterVideo
@@ -1461,9 +1464,6 @@ export default {
} else {
promise = promise.then(() => this.useVideoStream(null));
}
- if (config.enableScreenshotCapture) {
- APP.store.dispatch(toggleScreenshotCaptureEffect(false));
- }
return promise.then(
() => {
diff --git a/react/features/screenshot-capture/actions.js b/react/features/screenshot-capture/actions.js
index eb7bcb3816..ec028d09a6 100644
--- a/react/features/screenshot-capture/actions.js
+++ b/react/features/screenshot-capture/actions.js
@@ -34,17 +34,13 @@ export function toggleScreenshotCaptureEffect(enabled: boolean) {
if (state['features/screenshot-capture'].capturesEnabled !== enabled) {
const { jitsiTrack } = getLocalVideoTrack(state['features/base/tracks']);
+ // Screenshot capture effect doesn't return a modified stream. Therefore, we don't have to
+ // switch the stream at the conference level, starting/stopping the effect will suffice here.
return createScreenshotCaptureEffect(state)
- .then(effect =>
- jitsiTrack.setEffect(enabled ? effect : undefined)
- .then(() => {
- dispatch(setScreenshotCapture(enabled));
- })
- .catch(() => {
- dispatch(setScreenshotCapture(!enabled));
- })
- )
- .catch(() => dispatch(setScreenshotCapture(false)));
+ .then(effect => {
+ enabled ? effect.startEffect(jitsiTrack.getOriginalStream()) : effect.stopEffect();
+ dispatch(setScreenshotCapture(enabled));
+ });
}
return Promise.resolve();