snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
55
react/features/screenshot-capture/functions.tsx
Normal file
55
react/features/screenshot-capture/functions.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { IReduxState } from '../app/types';
|
||||
import { IStateful } from '../base/app/types';
|
||||
import { toState } from '../base/redux/functions';
|
||||
import { isCloudRecordingRunning } from '../recording/functions';
|
||||
import { isScreenVideoShared } from '../screen-share/functions';
|
||||
|
||||
import ScreenshotCaptureSummary from './ScreenshotCaptureSummary';
|
||||
|
||||
/**
|
||||
* Creates a new instance of ScreenshotCapture.
|
||||
*
|
||||
* @param {Object | Function} stateful - The redux store, state, or
|
||||
* {@code getState} function.
|
||||
* @returns {Promise<ScreenshotCapture>}
|
||||
*/
|
||||
export function createScreenshotCaptureSummary(stateful: IStateful) {
|
||||
if (!MediaStreamTrack.prototype.getSettings && !MediaStreamTrack.prototype.getConstraints) {
|
||||
return Promise.reject(new Error('ScreenshotCaptureSummary not supported!'));
|
||||
}
|
||||
|
||||
return new ScreenshotCaptureSummary(toState(stateful));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the screenshot capture is enabled based on the config.
|
||||
*
|
||||
* @param {Object} state - Redux state.
|
||||
* @param {boolean} checkSharing - Whether to check if screensharing is on.
|
||||
* @param {boolean} checkRecording - Whether to check is recording is on.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isScreenshotCaptureEnabled(state: IReduxState, checkSharing?: boolean, checkRecording?: boolean) {
|
||||
const { screenshotCapture } = state['features/base/config'];
|
||||
|
||||
if (!screenshotCapture?.enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkSharing && !isScreenVideoShared(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkRecording) {
|
||||
// Feature enabled always.
|
||||
if (screenshotCapture.mode === 'always') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Feature enabled only when recording is also on.
|
||||
return isCloudRecordingRunning(state);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user