2021-11-23 22:20:29 +08:00
|
|
|
import React, { useContext } from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2018-03-15 02:28:28 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2019-04-16 05:39:07 +08:00
|
|
|
import {
|
2020-12-10 06:00:54 +08:00
|
|
|
isVideoBroadcasting,
|
2021-02-06 06:18:39 +08:00
|
|
|
isGloballyBroadcasting,
|
2019-04-16 05:39:07 +08:00
|
|
|
} from './service';
|
2017-07-25 03:29:34 +08:00
|
|
|
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';
|
2021-11-23 22:20:29 +08:00
|
|
|
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
2021-12-09 00:24:26 +08:00
|
|
|
import { shouldEnableVolumeControl } from './service';
|
2022-02-10 03:45:43 +08:00
|
|
|
import MediaService from '/imports/ui/components/media/service';
|
2017-07-25 03:29:34 +08:00
|
|
|
|
2019-07-24 03:56:39 +08:00
|
|
|
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();
|
2021-09-10 21:16:44 +08:00
|
|
|
|
2021-07-13 03:47:06 +08:00
|
|
|
const { element } = fullscreen;
|
2021-09-10 21:16:44 +08:00
|
|
|
const fullscreenElementId = 'Screenshare';
|
2021-07-07 03:27:28 +08:00
|
|
|
const fullscreenContext = (element === fullscreenElementId);
|
2021-06-15 19:51:44 +08:00
|
|
|
|
2021-11-23 22:20:29 +08:00
|
|
|
const usingUsersContext = useContext(UsersContext);
|
|
|
|
const { users } = usingUsersContext;
|
|
|
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
|
|
|
const isPresenter = currentUser.presenter;
|
|
|
|
|
2020-12-10 06:00:54 +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,
|
2021-11-23 22:20:29 +08:00
|
|
|
isPresenter,
|
2021-07-07 03:27:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
2019-07-24 03:56:39 +08:00
|
|
|
return null;
|
|
|
|
};
|
2017-07-25 03:29:34 +08:00
|
|
|
|
2021-09-28 03:57:02 +08:00
|
|
|
const LAYOUT_CONFIG = Meteor.settings.public.layout;
|
|
|
|
|
2022-02-10 03:45:43 +08:00
|
|
|
export default withTracker(() => {
|
|
|
|
return {
|
|
|
|
isGloballyBroadcasting: isGloballyBroadcasting(),
|
|
|
|
toggleSwapLayout: MediaService.toggleSwapLayout,
|
|
|
|
hidePresentation: getFromUserSettings('bbb_hide_presentation', LAYOUT_CONFIG.hidePresentation),
|
|
|
|
enableVolumeControl: shouldEnableVolumeControl(),
|
|
|
|
};
|
|
|
|
})(ScreenshareContainer);
|