2017-07-25 03:29:34 +08:00
|
|
|
import React 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';
|
|
|
|
import mapUser from '/imports/ui/services/user/mapUser';
|
|
|
|
import { isVideoBroadcasting, presenterScreenshareHasEnded, unshareScreen,
|
2017-07-25 03:29:34 +08:00
|
|
|
presenterScreenshareHasStarted } from './service';
|
|
|
|
import ScreenshareComponent from './component';
|
|
|
|
|
|
|
|
class ScreenshareContainer extends React.Component {
|
|
|
|
render() {
|
|
|
|
if (this.props.isVideoBroadcasting()) {
|
|
|
|
return <ScreenshareComponent {...this.props} />;
|
|
|
|
}
|
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
return null;
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-15 02:28:28 +08:00
|
|
|
export default withTracker(() => {
|
|
|
|
const user = Users.findOne({ userId: Auth.userID });
|
|
|
|
const MappedUser = mapUser(user);
|
|
|
|
return {
|
|
|
|
isPresenter: MappedUser.isPresenter,
|
|
|
|
unshareScreen,
|
|
|
|
isVideoBroadcasting,
|
|
|
|
presenterScreenshareHasStarted,
|
|
|
|
presenterScreenshareHasEnded,
|
|
|
|
};
|
|
|
|
})(ScreenshareContainer);
|