2021-06-15 19:51:44 +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 Users from '/imports/api/users/';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
2020-06-11 21:16:22 +08:00
|
|
|
import MediaService, { getSwapLayout, shouldEnableSwapLayout } from '/imports/ui/components/media/service';
|
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-06-15 19:51:44 +08:00
|
|
|
import { NLayoutContext } from '../layout/context/context';
|
2017-07-25 03:29:34 +08:00
|
|
|
|
2019-07-24 03:56:39 +08:00
|
|
|
const ScreenshareContainer = (props) => {
|
2021-06-15 19:51:44 +08:00
|
|
|
const NewLayoutManager = useContext(NLayoutContext);
|
|
|
|
const { newLayoutContextState } = NewLayoutManager;
|
|
|
|
const { output, layoutLoaded } = newLayoutContextState;
|
2021-06-15 21:47:37 +08:00
|
|
|
const { screenShare } = output;
|
2021-06-15 19:51:44 +08:00
|
|
|
|
2020-12-10 06:00:54 +08:00
|
|
|
if (isVideoBroadcasting()) {
|
2021-06-15 21:47:37 +08:00
|
|
|
return <ScreenshareComponent {...props} {...screenShare} layoutLoaded={layoutLoaded} />;
|
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
|
|
|
|
2018-03-15 02:28:28 +08:00
|
|
|
export default withTracker(() => {
|
2019-08-30 00:26:07 +08:00
|
|
|
const user = Users.findOne({ userId: Auth.userID }, { fields: { presenter: 1 } });
|
2018-03-15 02:28:28 +08:00
|
|
|
return {
|
2021-02-06 06:18:39 +08:00
|
|
|
isGloballyBroadcasting: isGloballyBroadcasting(),
|
2019-08-22 04:39:06 +08:00
|
|
|
isPresenter: user.presenter,
|
2020-06-11 21:16:22 +08:00
|
|
|
getSwapLayout,
|
|
|
|
shouldEnableSwapLayout,
|
|
|
|
toggleSwapLayout: MediaService.toggleSwapLayout,
|
2018-03-15 02:28:28 +08:00
|
|
|
};
|
|
|
|
})(ScreenshareContainer);
|