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

35 lines
1.2 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-06-15 19:51:44 +08:00
import { NLayoutContext } from '../layout/context/context';
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
if (isVideoBroadcasting()) {
2021-06-15 21:47:37 +08:00
return <ScreenshareComponent {...props} {...screenShare} layoutLoaded={layoutLoaded} />;
}
return null;
};
export default withTracker(() => {
const user = Users.findOne({ userId: Auth.userID }, { fields: { presenter: 1 } });
return {
isGloballyBroadcasting: isGloballyBroadcasting(),
isPresenter: user.presenter,
getSwapLayout,
shouldEnableSwapLayout,
toggleSwapLayout: MediaService.toggleSwapLayout,
};
})(ScreenshareContainer);