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.
pull/5094/head jitsi-meet_4244
Jaya Allamsetty 5 years ago committed by Jaya Allamsetty
parent bd8a7edbd2
commit da68b9882d
  1. 6
      conference.js
  2. 16
      react/features/screenshot-capture/actions.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(
() => {

@ -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();

Loading…
Cancel
Save