diff --git a/react/features/base/conference/middleware.web.js b/react/features/base/conference/middleware.web.js index 2b6da9fce..5db1cc9d0 100644 --- a/react/features/base/conference/middleware.web.js +++ b/react/features/base/conference/middleware.web.js @@ -8,6 +8,7 @@ import { setSkipPrejoinOnReload } from '../../prejoin'; import { setScreenAudioShareState, setScreenshareAudioTrack } from '../../screen-share'; +import { isScreenshotCaptureEnabled, toggleScreenshotCaptureSummary } from '../../screenshot-capture'; import { AudioMixerEffect } from '../../stream-effects/audio-mixer/AudioMixerEffect'; import { setAudioOnly } from '../audio-only'; import { getMultipleVideoSendingSupportFeatureFlag } from '../config/functions.any'; @@ -165,6 +166,9 @@ async function _toggleScreenSharing({ enabled, audioOnly = false }, store) { } else { await dispatch(addLocalTrack(desktopVideoTrack)); } + if (isScreenshotCaptureEnabled(state, false, true)) { + dispatch(toggleScreenshotCaptureSummary(true)); + } } // Apply the AudioMixer effect if there is a local audio track, add the desktop track to the conference @@ -188,6 +192,8 @@ async function _toggleScreenSharing({ enabled, audioOnly = false }, store) { } else { const { desktopAudioTrack } = state['features/screen-share']; + dispatch(toggleScreenshotCaptureSummary(false)); + // Mute the desktop track instead of removing it from the conference since we don't want the client to signal // a source-remove to the remote peer for the screenshare track. Later when screenshare is enabled again, the // same sender will be re-used without the need for signaling a new ssrc through source-add. diff --git a/react/features/screenshot-capture/actions.js b/react/features/screenshot-capture/actions.js index d38e12400..f0b771320 100644 --- a/react/features/screenshot-capture/actions.js +++ b/react/features/screenshot-capture/actions.js @@ -1,7 +1,7 @@ // @flow -import { getLocalVideoTrack } from '../../features/base/tracks'; - +import { getLocalJitsiDesktopTrack, getLocalJitsiVideoTrack } from '../../features/base/tracks'; +import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config'; import { SET_SCREENSHOT_CAPTURE } from './actionTypes'; import { createScreenshotCaptureSummary } from './functions'; @@ -46,12 +46,13 @@ export function toggleScreenshotCaptureSummary(enabled: boolean) { if (enabled) { try { - const { jitsiTrack } = getLocalVideoTrack(state['features/base/tracks']); + const jitsiTrack = getMultipleVideoSendingSupportFeatureFlag(state) + ? getLocalJitsiDesktopTrack(state) + : getLocalJitsiVideoTrack(state); await screenshotSummary.start(jitsiTrack); dispatch(setScreenshotCapture(enabled)); } catch { - // Handle promise rejection from {@code start} due to stream type not being desktop. logger.error('Unsupported stream type.'); } diff --git a/react/features/screenshot-capture/index.js b/react/features/screenshot-capture/index.js index 485f1b10a..abee88218 100644 --- a/react/features/screenshot-capture/index.js +++ b/react/features/screenshot-capture/index.js @@ -1 +1,2 @@ export * from './actions'; +export * from './functions';