bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-provider/video-button/service.js

41 lines
1.1 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 Users from '/imports/api/users/';
import VideoService from '../service';
2019-03-29 23:47:07 +08:00
const baseName = Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename;
const isSharingVideo = () => {
const userId = Auth.userID;
2018-03-15 20:58:56 +08:00
const user = Users.findOne({ userId });
2019-06-13 02:03:23 +08:00
return !!user.hasStream;
};
2018-03-23 01:02:59 +08:00
const videoShareAllowed = () => Settings.dataSaving.viewParticipantsWebcams;
2018-03-15 20:58:56 +08:00
const isDisabled = () => {
const isWaitingResponse = VideoService.isWaitingResponse();
const isConnected = VideoService.isConnected();
2018-03-27 02:26:52 +08:00
const lockCam = VideoService.isLocked();
2018-03-15 20:58:56 +08:00
const user = Users.findOne({ userId: Auth.userID });
const userLocked = mapUser(user).isLocked;
const isConnecting = (!isSharingVideo && isConnected);
const isLocked = (lockCam && userLocked);
2018-03-15 20:58:56 +08:00
return isLocked
|| isWaitingResponse
|| isConnecting
2018-03-23 01:02:59 +08:00
|| !videoShareAllowed();
2018-03-15 20:58:56 +08:00
};
export default {
2018-03-15 20:58:56 +08:00
isSharingVideo,
isDisabled,
baseName,
2018-03-23 01:02:59 +08:00
videoShareAllowed,
};