bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-dock/video-menu/service.js

43 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-03-15 20:58:56 +08:00
import Settings from '/imports/ui/services/settings';
import mapUser from '/imports/ui/services/user/mapUser';
import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings/';
import Users from '/imports/api/users/';
import VideoService from '../service';
const baseName = Meteor.settings.public.app.basename;
const isSharingVideo = () => {
const userId = Auth.userID;
2018-03-15 20:58:56 +08:00
const user = Users.findOne({ userId });
return !!user.has_stream;
};
2018-03-15 20:58:56 +08:00
const isDisabled = () => {
const isWaitingResponse = VideoService.isWaitingResponse();
const isConnected = VideoService.isConnected();
const videoSettings = Settings.dataSaving;
2018-03-15 20:58:56 +08:00
const enableShare = !videoSettings.viewParticipantsWebcams;
const meeting = Meetings.findOne({ meetingId: Auth.meetingID });
const LockCam = meeting.lockSettingsProp ? meeting.lockSettingsProp.disableCam : false;
const webcamOnlyModerator = meeting.usersProp.webcamsOnlyForModerator;
const user = Users.findOne({ userId: Auth.userID });
const userLocked = mapUser(user).isLocked;
const isConecting = (!isSharingVideo && isConnected);
const isLocked = (LockCam && userLocked) || webcamOnlyModerator;
return isLocked
|| isWaitingResponse
|| isConecting
|| enableShare;
};
export default {
2018-03-15 20:58:56 +08:00
isSharingVideo,
isDisabled,
baseName,
};