feat(base/tracks): removed pip limitation while screensharing

This commit is contained in:
Calin-Teodor
2024-12-06 13:26:11 +02:00
committed by Calinteodor
parent 79ece5d4e5
commit 3834f1e99c
3 changed files with 3 additions and 30 deletions

View File

@@ -176,12 +176,6 @@ export const PARTICIPANTS_ENABLED = 'participants.enabled';
*/
export const PIP_ENABLED = 'pip.enabled';
/**
* Flag indicating if Picture-in-Picture button should be shown while screen sharing.
* Default: disabled (false).
*/
export const PIP_WHILE_SCREEN_SHARING_ENABLED = 'pip-while-screen-sharing.enabled';
/**
* Flag indicating if the prejoin page should be enabled.
* Default: enabled (true).

View File

@@ -1,14 +1,11 @@
import { IReduxState, IStore } from '../../app/types';
import { setPictureInPictureEnabled } from '../../mobile/picture-in-picture/functions';
import { showNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
import { PIP_WHILE_SCREEN_SHARING_ENABLED } from '../flags/constants';
import { getFeatureFlag } from '../flags/functions';
import JitsiMeetJS from '../lib-jitsi-meet';
import { setScreenshareMuted } from '../media/actions';
import { addLocalTrack, replaceLocalTrack } from './actions.any';
import { getLocalDesktopTrack, getTrackState, isLocalVideoTrackDesktop } from './functions.native';
import { getLocalDesktopTrack, getTrackState } from './functions.native';
export * from './actions.any';
@@ -26,14 +23,9 @@ export function toggleScreensharing(enabled: boolean, _ignore1?: boolean, _ignor
const state = getState();
if (enabled) {
const isSharing = isLocalVideoTrackDesktop(state);
if (!isSharing) {
_startScreenSharing(dispatch, state);
}
_startScreenSharing(dispatch, state);
} else {
dispatch(setScreenshareMuted(true));
setPictureInPictureEnabled(true);
}
};
}
@@ -47,12 +39,6 @@ export function toggleScreensharing(enabled: boolean, _ignore1?: boolean, _ignor
* @returns {void}
*/
async function _startScreenSharing(dispatch: IStore['dispatch'], state: IReduxState) {
const pipWhileScreenSharingEnabled = getFeatureFlag(state, PIP_WHILE_SCREEN_SHARING_ENABLED, false);
if (!pipWhileScreenSharingEnabled) {
setPictureInPictureEnabled(false);
}
try {
const tracks: any[] = await JitsiMeetJS.createLocalTracks({ devices: [ 'desktop' ] });
const track = tracks[0];
@@ -78,7 +64,5 @@ async function _startScreenSharing(dispatch: IStore['dispatch'], state: IReduxSt
}
} catch (error: any) {
console.log('ERROR creating screen-sharing stream ', error);
setPictureInPictureEnabled(true);
}
}

View File

@@ -1,12 +1,9 @@
import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { PIP_WHILE_SCREEN_SHARING_ENABLED } from '../../../base/flags/constants';
import { getFeatureFlag } from '../../../base/flags/functions';
import { translate } from '../../../base/i18n/functions';
import { IconArrowDown } from '../../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { isLocalVideoTrackDesktop } from '../../../base/tracks/functions.native';
import { enterPictureInPicture } from '../actions';
import { isPipEnabled } from '../functions';
@@ -58,9 +55,7 @@ class PictureInPictureButton extends AbstractButton<IProps> {
* }}
*/
function _mapStateToProps(state: IReduxState) {
const pipEnabled = isPipEnabled(state);
const pipWhileScreenSharingEnabled = getFeatureFlag(state, PIP_WHILE_SCREEN_SHARING_ENABLED, false);
const enabled = pipEnabled && (!isLocalVideoTrackDesktop(state) || pipWhileScreenSharingEnabled);
const enabled = isPipEnabled(state);
return {
_enabled: enabled