bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/screenshare/container.jsx

59 lines
1.8 KiB
React
Raw Normal View History

2021-06-15 19:51:44 +08:00
import React, { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import Users from '/imports/api/users/';
import Auth from '/imports/ui/services/auth';
import MediaService, {
getSwapLayout,
shouldEnableSwapLayout,
} from '/imports/ui/components/media/service';
import {
isVideoBroadcasting,
isGloballyBroadcasting,
} from './service';
import ScreenshareComponent from './component';
2021-08-05 19:03:24 +08:00
import LayoutContext from '../layout/context';
2021-09-28 03:57:02 +08:00
import getFromUserSettings from '/imports/ui/services/users-settings';
import { shouldEnableVolumeControl } from './service';
const ScreenshareContainer = (props) => {
2021-07-07 03:27:28 +08:00
const fullscreenElementId = 'Screenshare';
2021-08-05 19:03:24 +08:00
const layoutContext = useContext(LayoutContext);
const { layoutContextState, layoutContextDispatch } = layoutContext;
const { output, fullscreen } = layoutContextState;
2021-06-15 21:47:37 +08:00
const { screenShare } = output;
const { element } = fullscreen;
2021-07-07 03:27:28 +08:00
const fullscreenContext = (element === fullscreenElementId);
2021-06-15 19:51:44 +08:00
if (isVideoBroadcasting()) {
2021-07-07 03:27:28 +08:00
return (
<ScreenshareComponent
{
...{
2021-08-05 19:03:24 +08:00
layoutContextDispatch,
2021-07-07 03:27:28 +08:00
...props,
...screenShare,
fullscreenContext,
fullscreenElementId,
}
}
/>
);
}
return null;
};
2021-09-28 03:57:02 +08:00
const LAYOUT_CONFIG = Meteor.settings.public.layout;
export default withTracker(() => {
const user = Users.findOne({ userId: Auth.userID }, { fields: { presenter: 1 } });
return {
isGloballyBroadcasting: isGloballyBroadcasting(),
isPresenter: user.presenter,
getSwapLayout,
shouldEnableSwapLayout,
toggleSwapLayout: MediaService.toggleSwapLayout,
2021-09-28 03:57:02 +08:00
hidePresentation: getFromUserSettings('bbb_hide_presentation', LAYOUT_CONFIG.hidePresentation),
enableVolumeControl: shouldEnableVolumeControl(),
};
})(ScreenshareContainer);