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

58 lines
1.9 KiB
React
Raw Normal View History

import React, { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import Auth from '/imports/ui/services/auth';
import {
isVideoBroadcasting,
isGloballyBroadcasting,
} from './service';
import ScreenshareComponent from './component';
2021-09-11 04:48:52 +08:00
import { layoutSelect, layoutSelectOutput, layoutDispatch } from '../layout/context';
2021-09-28 03:57:02 +08:00
import getFromUserSettings from '/imports/ui/services/users-settings';
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
import { shouldEnableVolumeControl } from './service';
import MediaService from '/imports/ui/components/media/service';
const ScreenshareContainer = (props) => {
2021-09-11 04:48:52 +08:00
const screenShare = layoutSelectOutput((i) => i.screenShare);
const fullscreen = layoutSelect((i) => i.fullscreen);
const layoutContextDispatch = layoutDispatch();
const { element } = fullscreen;
const fullscreenElementId = 'Screenshare';
2021-07-07 03:27:28 +08:00
const fullscreenContext = (element === fullscreenElementId);
2021-06-15 19:51:44 +08:00
const usingUsersContext = useContext(UsersContext);
const { users } = usingUsersContext;
const currentUser = users[Auth.meetingID][Auth.userID];
const isPresenter = currentUser.presenter;
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,
isPresenter,
2021-07-07 03:27:28 +08:00
}
}
/>
);
}
return null;
};
2021-09-28 03:57:02 +08:00
const LAYOUT_CONFIG = Meteor.settings.public.layout;
export default withTracker(() => {
return {
isGloballyBroadcasting: isGloballyBroadcasting(),
toggleSwapLayout: MediaService.toggleSwapLayout,
hidePresentation: getFromUserSettings('bbb_hide_presentation', LAYOUT_CONFIG.hidePresentation),
enableVolumeControl: shouldEnableVolumeControl(),
};
})(ScreenshareContainer);