snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
58
react/features/screen-share/functions.ts
Normal file
58
react/features/screen-share/functions.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { IReduxState } from '../app/types';
|
||||
import { isWindows } from '../base/environment/environment';
|
||||
import { isMobileBrowser } from '../base/environment/utils';
|
||||
import { browser } from '../base/lib-jitsi-meet';
|
||||
import { getLocalDesktopTrack } from '../base/tracks/functions';
|
||||
|
||||
/**
|
||||
* Is the current screen sharing session audio only.
|
||||
*
|
||||
* @param {IReduxState} state - The state of the application.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isAudioOnlySharing(state: IReduxState) {
|
||||
return isScreenAudioShared(state) && !isScreenVideoShared(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* State of audio sharing.
|
||||
*
|
||||
* @param {IReduxState} state - The state of the application.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isScreenAudioShared(state: IReduxState) {
|
||||
return state['features/screen-share'].isSharingAudio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the visibility of the audio only screen share button. Currently only chrome browser and electron on
|
||||
* windows supports this functionality.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isScreenAudioSupported() {
|
||||
return (!isMobileBrowser() && browser.isChromiumBased()) || (browser.isElectron() && isWindows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Is any screen media currently being shared, audio or video.
|
||||
*
|
||||
* @param {IReduxState} state - The state of the application.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isScreenMediaShared(state: IReduxState) {
|
||||
return isScreenAudioShared(state) || isScreenVideoShared(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is screen sharing currently active.
|
||||
*
|
||||
* @param {IReduxState} state - The state of the application.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isScreenVideoShared(state: IReduxState) {
|
||||
const tracks = state['features/base/tracks'];
|
||||
const localScreenshare = getLocalDesktopTrack(tracks);
|
||||
|
||||
return localScreenshare?.jitsiTrack && !localScreenshare.jitsiTrack.isMuted();
|
||||
}
|
||||
Reference in New Issue
Block a user