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;
|
2017-12-09 00:38:51 +08:00
|
|
|
|
|
|
|
const isSharingVideo = () => {
|
|
|
|
const userId = Auth.userID;
|
2018-03-15 20:58:56 +08:00
|
|
|
const user = Users.findOne({ userId });
|
|
|
|
return !!user.has_stream;
|
2017-12-09 00:38:51 +08:00
|
|
|
};
|
|
|
|
|
2018-03-15 20:58:56 +08:00
|
|
|
const isDisabled = () => {
|
|
|
|
const isWaitingResponse = VideoService.isWaitingResponse();
|
|
|
|
const isConnected = VideoService.isConnected();
|
|
|
|
|
2018-03-16 03:55:54 +08:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-09 00:38:51 +08:00
|
|
|
export default {
|
2018-03-15 20:58:56 +08:00
|
|
|
isSharingVideo,
|
|
|
|
isDisabled,
|
|
|
|
baseName,
|
2017-12-09 00:38:51 +08:00
|
|
|
};
|