Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions react/features/base/flags/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
20 changes: 2 additions & 18 deletions react/features/base/tracks/actions.native.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
}
};
}
Expand All @@ -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);
Calinteodor marked this conversation as resolved.
Show resolved Hide resolved
}

try {
const tracks: any[] = await JitsiMeetJS.createLocalTracks({ devices: [ 'desktop' ] });
const track = tracks[0];
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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
Expand Down
Loading