2021-05-25 01:05:39 +08:00
|
|
|
import React, { useContext } from 'react';
|
2021-06-22 04:16:59 +08:00
|
|
|
|
2022-02-15 23:54:55 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/common/modal/service';
|
2021-06-22 04:16:59 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2022-02-10 03:45:43 +08:00
|
|
|
import MediaService from '/imports/ui/components/media/service';
|
2021-06-22 04:16:59 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import VideoService from '/imports/ui/components/video-provider/service';
|
2021-08-04 22:38:20 +08:00
|
|
|
import { UsersContext } from '../components-data/users-context/context';
|
2021-09-11 04:48:52 +08:00
|
|
|
import {
|
|
|
|
layoutSelect,
|
|
|
|
layoutSelectInput,
|
|
|
|
layoutSelectOutput,
|
|
|
|
layoutDispatch,
|
|
|
|
} from '../layout/context';
|
2021-07-13 03:47:06 +08:00
|
|
|
import WebcamComponent from '/imports/ui/components/webcam/component';
|
2021-05-25 01:05:39 +08:00
|
|
|
|
2021-06-22 04:16:59 +08:00
|
|
|
const WebcamContainer = ({
|
|
|
|
audioModalIsOpen,
|
|
|
|
swapLayout,
|
|
|
|
usersVideo,
|
|
|
|
}) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const fullscreen = layoutSelect((i) => i.fullscreen);
|
|
|
|
const isRTL = layoutSelect((i) => i.isRTL);
|
|
|
|
const cameraDockInput = layoutSelectInput((i) => i.cameraDock);
|
2022-02-05 02:08:19 +08:00
|
|
|
const focusedId = layoutSelectInput((i) => i.focusedId);
|
2021-09-11 04:48:52 +08:00
|
|
|
const presentation = layoutSelectOutput((i) => i.presentation);
|
|
|
|
const cameraDock = layoutSelectOutput((i) => i.cameraDock);
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-09-10 21:16:44 +08:00
|
|
|
|
2021-08-07 01:23:46 +08:00
|
|
|
const { cameraOptimalGridSize } = cameraDockInput;
|
2021-08-10 20:05:34 +08:00
|
|
|
const { display: displayPresentation } = presentation;
|
2021-06-22 04:16:59 +08:00
|
|
|
|
2021-08-04 22:38:20 +08:00
|
|
|
const usingUsersContext = useContext(UsersContext);
|
|
|
|
const { users } = usingUsersContext;
|
|
|
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
|
|
|
|
2021-10-13 20:30:08 +08:00
|
|
|
return !audioModalIsOpen
|
2021-06-22 04:16:59 +08:00
|
|
|
&& usersVideo.length > 0
|
|
|
|
? (
|
|
|
|
<WebcamComponent
|
|
|
|
{...{
|
|
|
|
swapLayout,
|
|
|
|
usersVideo,
|
2022-02-11 22:30:35 +08:00
|
|
|
focusedId: cameraDock.focusedId,
|
2021-07-13 03:47:06 +08:00
|
|
|
cameraDock,
|
|
|
|
cameraOptimalGridSize,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-13 03:47:06 +08:00
|
|
|
fullscreen,
|
2021-08-04 22:38:20 +08:00
|
|
|
isPresenter: currentUser.presenter,
|
2021-08-12 03:28:36 +08:00
|
|
|
displayPresentation,
|
2021-08-07 01:23:46 +08:00
|
|
|
isRTL,
|
2021-06-22 04:16:59 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
: null;
|
2021-05-25 01:05:39 +08:00
|
|
|
};
|
|
|
|
|
2022-02-11 22:30:35 +08:00
|
|
|
export default withModalMounter(withTracker((props) => {
|
2023-02-27 22:01:23 +08:00
|
|
|
const { hasCurrentPresentation } = MediaService.getPresentationInfo();
|
2021-06-22 04:16:59 +08:00
|
|
|
const data = {
|
|
|
|
audioModalIsOpen: Session.get('audioModalIsOpen'),
|
|
|
|
isMeteorConnected: Meteor.status().connected,
|
|
|
|
};
|
|
|
|
|
|
|
|
const { streams: usersVideo } = VideoService.getVideoStreams();
|
|
|
|
data.usersVideo = usersVideo;
|
2023-02-27 22:01:23 +08:00
|
|
|
data.swapLayout = !hasCurrentPresentation || props.isLayoutSwapped;
|
2021-06-22 04:16:59 +08:00
|
|
|
|
|
|
|
if (data.swapLayout) {
|
|
|
|
data.floatingOverlay = true;
|
|
|
|
data.hideOverlay = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
})(WebcamContainer));
|