Fix video swap when there's no presentation and/or screenshare/external video

This commit is contained in:
Lucas Zawacki 2019-09-16 19:00:05 -03:00
parent f548281a07
commit 5dd46f8f48
5 changed files with 9 additions and 32 deletions

View File

@ -10,32 +10,6 @@ import CaptionsButtonContainer from '/imports/ui/components/actions-bar/captions
import PresentationOptionsContainer from './presentation-options/component';
class ActionsBar extends PureComponent {
componentDidUpdate(prevProps) {
const { isThereCurrentPresentation: prevIsThereCurrPresentation } = prevProps;
const {
isThereCurrentPresentation,
getSwapLayout,
toggleSwapLayout,
isSharingVideo,
isVideoBroadcasting,
} = this.props;
// TODO: THIS BREAKS AUTO SWAP BIGLY AND SHOULD BE FIXED IN MEDIA CONTAINER
// if (!isThereCurrentPresentation && !isSharingVideo && !isVideoBroadcasting) {
// if (!getSwapLayout()) {
// toggleSwapLayout();
// }
// }
// if (!prevIsThereCurrPresentation
// && isThereCurrentPresentation
// && !isSharingVideo
// && !isVideoBroadcasting) {
// if (getSwapLayout()) {
// toggleSwapLayout();
// }
// }
}
render() {
const {
@ -62,10 +36,10 @@ class ActionsBar extends PureComponent {
isMeteorConnected,
isPollingEnabled,
isThereCurrentPresentation,
allowExternalVideo,
} = this.props;
const actionBarClasses = {};
const { enabled: enableExternalVideo } = Meteor.settings.public.externalVideoPlayer;
actionBarClasses[styles.centerWithActions] = amIPresenter;
actionBarClasses[styles.center] = true;
@ -77,7 +51,7 @@ class ActionsBar extends PureComponent {
amIPresenter,
amIModerator,
isPollingEnabled,
allowExternalVideo: enableExternalVideo,
allowExternalVideo,
handleTakePresenter,
intl,
isSharingVideo,

View File

@ -51,5 +51,5 @@ export default withTracker(() => ({
isPollingEnabled: POLLING_ENABLED,
isThereCurrentPresentation: Presentations.findOne({ meetingId: Auth.meetingID, current: true },
{ fields: {} }),
getSwapLayout,
allowExternalVideo: Meteor.settings.public.externalVideoPlayer.enabled,
}))(injectIntl(ActionsBarContainer));

View File

@ -60,7 +60,6 @@ class ExternalVideoModal extends Component {
const {
startWatching,
closeModal,
isSwapped,
} = this.props;
const { url } = this.state;

View File

@ -105,6 +105,7 @@ export default withModalMounter(withTracker(() => {
const { dataSaving } = Settings;
const { viewParticipantsWebcams, viewScreenshare } = dataSaving;
const hidePresentation = getFromUserSettings('hidePresentation', LAYOUT_CONFIG.hidePresentation);
const { current_presentation: hasPresentation } = MediaService.getPresentationInfo();
const data = {
children: <DefaultContent />,
audioModalIsOpen: Session.get('audioModalIsOpen'),
@ -130,7 +131,7 @@ export default withModalMounter(withTracker(() => {
}
data.isScreensharing = MediaService.isVideoBroadcasting();
data.swapLayout = getSwapLayout() && shouldEnableSwapLayout();
data.swapLayout = (getSwapLayout() || !hasPresentation) && shouldEnableSwapLayout();
data.disableVideo = !viewParticipantsWebcams;
if (data.swapLayout) {

View File

@ -62,10 +62,13 @@ export const shouldEnableSwapLayout = () => {
const { viewParticipantsWebcams } = Settings.dataSaving;
const usersVideo = VideoService.getAllWebcamUsers();
const poll = PollingService.mapPolls();
const { current_presentation: hasPresentation } = getPresentationInfo();
return usersVideo.length > 0 // prevent swap without any webcams
&& viewParticipantsWebcams // prevent swap when dataSaving for webcams is enabled
&& !poll.pollExists; // prevent swap when there is a poll running
&& !poll.pollExists // prevent swap when there is a poll running
&& !shouldShowScreenshare() // and when there's screenshare
&& !shouldShowExternalVideo() // or there's an external video
};
export const getSwapLayout = () => {