mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-12 20:12:31 +00:00
* feat(multi-stream-support) Add screenshare as a second video track to the call. This feature is behind a sendMultipleVideoStreams config.js flag. sourceNameSignaling flag also needs to enabled. Sending multiple tracks is currently supported only on endpoints running in unified plan mode. However, clients with source-name signaling enabled and running in plan-b can still receive multiple streams . * squash: check if there is an existing track before adding camera/desktop * squash: enable multi-stream only on unified plan endpoints.
69 lines
2.1 KiB
JavaScript
69 lines
2.1 KiB
JavaScript
// @flow
|
|
|
|
import { getMultipleVideoSupportFeatureFlag } from '../base/config';
|
|
import { isWindows } from '../base/environment';
|
|
import { isMobileBrowser } from '../base/environment/utils';
|
|
import { browser } from '../base/lib-jitsi-meet';
|
|
import { VIDEO_TYPE } from '../base/media';
|
|
import { getLocalDesktopTrack, getLocalVideoTrack } from '../base/tracks';
|
|
|
|
/**
|
|
* Is the current screen sharing session audio only.
|
|
*
|
|
* @param {Object} state - The state of the application.
|
|
* @returns {boolean}
|
|
*/
|
|
export function isAudioOnlySharing(state: Object) {
|
|
return isScreenAudioShared(state) && !isScreenVideoShared(state);
|
|
}
|
|
|
|
/**
|
|
* State of audio sharing.
|
|
*
|
|
* @param {Object} state - The state of the application.
|
|
* @returns {boolean}
|
|
*/
|
|
export function isScreenAudioShared(state: Object) {
|
|
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.isChrome()) || (browser.isElectron() && isWindows());
|
|
}
|
|
|
|
/**
|
|
* Is any screen media currently being shared, audio or video.
|
|
*
|
|
* @param {Object} state - The state of the application.
|
|
* @returns {boolean}
|
|
*/
|
|
export function isScreenMediaShared(state: Object) {
|
|
return isScreenAudioShared(state) || isScreenVideoShared(state);
|
|
}
|
|
|
|
/**
|
|
* Is screen sharing currently active.
|
|
*
|
|
* @param {Object} state - The state of the application.
|
|
* @returns {boolean}
|
|
*/
|
|
export function isScreenVideoShared(state: Object) {
|
|
const tracks = state['features/base/tracks'];
|
|
const localScreenshare = getLocalDesktopTrack(tracks);
|
|
|
|
if (getMultipleVideoSupportFeatureFlag(state)) {
|
|
|
|
return localScreenshare && localScreenshare.jitsiTrack && !localScreenshare.jitsiTrack.isMuted();
|
|
}
|
|
const localVideo = getLocalVideoTrack(tracks);
|
|
|
|
// $FlowFixMe - No support for optional chain method calls in flow atm.
|
|
return localVideo?.jitsiTrack?.getVideoType() === VIDEO_TYPE.DESKTOP;
|
|
}
|