diff --git a/react/features/base/flags/constants.ts b/react/features/base/flags/constants.ts index 67031df0c..d7e17db56 100644 --- a/react/features/base/flags/constants.ts +++ b/react/features/base/flags/constants.ts @@ -160,6 +160,12 @@ export const OVERFLOW_MENU_ENABLED = 'overflow-menu.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). diff --git a/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js b/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js index 66a1fce76..e9b281d52 100644 --- a/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js +++ b/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js @@ -2,7 +2,7 @@ import { NativeModules, Platform } from 'react-native'; -import { PIP_ENABLED, getFeatureFlag } from '../../../base/flags'; +import { PIP_ENABLED, PIP_WHILE_SCREEN_SHARING_ENABLED, getFeatureFlag } from '../../../base/flags'; import { translate } from '../../../base/i18n'; import { IconArrowDown } from '../../../base/icons'; import { connect } from '../../../base/redux'; @@ -63,8 +63,10 @@ class PictureInPictureButton extends AbstractButton { * }} */ function _mapStateToProps(state): Object { - const flag = Boolean(getFeatureFlag(state, PIP_ENABLED)); - let enabled = flag && !isLocalVideoTrackDesktop(state); + const pipEnabled = Boolean(getFeatureFlag(state, PIP_ENABLED)); + const pipWhileScreenSharingEnabled = getFeatureFlag(state, PIP_WHILE_SCREEN_SHARING_ENABLED, false); + + let enabled = pipEnabled && (!isLocalVideoTrackDesktop(state) || pipWhileScreenSharingEnabled); // Override flag for Android, since it might be unsupported. if (Platform.OS === 'android' && !NativeModules.PictureInPicture.SUPPORTED) {