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.
This commit is contained in:
Jaya Allamsetty 2020-02-25 10:22:10 -05:00 committed by Jaya Allamsetty
parent bd8a7edbd2
commit da68b9882d
2 changed files with 9 additions and 13 deletions

View File

@ -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(
() => {

View File

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