Fix lock settings for video dock

This commit is contained in:
Lucas Fialho Zawacki 2018-03-22 14:14:54 +00:00
parent e823308eba
commit cb90c21e84
5 changed files with 21 additions and 21 deletions

View File

@ -101,13 +101,6 @@ class VideoProvider extends Component {
this.ws.close(); this.ws.close();
} }
componentWillUpdate(nextProps) {
const { isLocked } = nextProps;
if (isLocked && VideoService.isConnected()) {
this.unshareWebcam();
}
}
onWsOpen() { onWsOpen() {
log('debug', '------ Websocket connection opened.'); log('debug', '------ Websocket connection opened.');
@ -370,6 +363,7 @@ class VideoProvider extends Component {
cameraId: id, cameraId: id,
}); });
this.unshareWebcam();
VideoService.exitedVideo(); VideoService.exitedVideo();
} }
@ -381,11 +375,7 @@ class VideoProvider extends Component {
log('info', 'Handle play stop <--------------------'); log('info', 'Handle play stop <--------------------');
log('error', message); log('error', message);
if (id === this.props.userId) { this.stop(id);
this.unshareWebcam();
} else {
this.stop(id);
}
} }
handlePlayStart(message) { handlePlayStart(message) {
@ -447,6 +437,7 @@ class VideoProvider extends Component {
sharedWebcam={this.state.sharedWebcam} sharedWebcam={this.state.sharedWebcam}
onShareWebcam={this.shareWebcam.bind(this)} onShareWebcam={this.shareWebcam.bind(this)}
socketOpen={this.state.socketOpen} socketOpen={this.state.socketOpen}
isLocked={this.props.isLocked}
/> />
); );
} }

View File

@ -6,6 +6,7 @@ import VideoService from './service';
const VideoProviderContainer = ({ children, ...props }) => <VideoProvider {...props}>{children}</VideoProvider>; const VideoProviderContainer = ({ children, ...props }) => <VideoProvider {...props}>{children}</VideoProvider>;
export default withTracker(() => ({ export default withTracker(() => ({
isLocked: VideoService.isLocked(),
meetingId: VideoService.meetingId(), meetingId: VideoService.meetingId(),
userId: VideoService.userId(), userId: VideoService.userId(),
}))(VideoProviderContainer); }))(VideoProviderContainer);

View File

@ -1,6 +1,7 @@
import { Tracker } from 'meteor/tracker'; import { Tracker } from 'meteor/tracker';
import { makeCall } from '/imports/ui/services/api'; import { makeCall } from '/imports/ui/services/api';
import Users from '/imports/api/users'; import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings/';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
class VideoService { class VideoService {
@ -69,6 +70,16 @@ class VideoService {
return Users.find().fetch(); return Users.find().fetch();
} }
webcamOnlyModerator() {
const m = Meetings.findOne({meetingId: Auth.meetingID});
return m.usersProp.webcamsOnlyForModerator;
}
isLocked() {
const m = Meetings.findOne({meetingId: Auth.meetingID});
return m.lockSettingsProp ? m.lockSettingsProp.disableCam : false;
}
userId() { userId() {
return Auth.userID; return Auth.userID;
} }
@ -93,6 +104,8 @@ export default {
exitingVideo: () => videoService.exitingVideo(), exitingVideo: () => videoService.exitingVideo(),
exitedVideo: () => videoService.exitedVideo(), exitedVideo: () => videoService.exitedVideo(),
getAllUsers: () => videoService.getAllUsers(), getAllUsers: () => videoService.getAllUsers(),
webcamOnlyModerator: () => videoService.webcamOnlyModerator(),
isLocked: () => videoService.isLocked(),
isConnected: () => videoService.isConnected, isConnected: () => videoService.isConnected,
isWaitingResponse: () => videoService.isWaitingResponse, isWaitingResponse: () => videoService.isWaitingResponse,
joinVideo: () => videoService.joinVideo(), joinVideo: () => videoService.joinVideo(),

View File

@ -10,8 +10,6 @@ import _ from 'lodash';
import VideoElement from '../video-element/component'; import VideoElement from '../video-element/component';
const INITIAL_SHARE_WAIT_TIME = 2000;
const intlMessages = defineMessages({ const intlMessages = defineMessages({
chromeExtensionError: { chromeExtensionError: {
id: 'app.video.chromeExtensionError', id: 'app.video.chromeExtensionError',
@ -77,14 +75,14 @@ class VideoDock extends Component {
getUsersWithActiveStreams() { getUsersWithActiveStreams() {
const { userId, sharedWebcam } = this.props; const { userId, sharedWebcam } = this.props;
const activeFilter = (user) => { const activeFilter = (user) => {
return user.has_stream || (sharedWebcam && user.userId == userId); return (!user.locked && user.has_stream) || (sharedWebcam && user.userId == userId);
}; };
return this.props.users.filter(activeFilter); return this.props.users.filter(activeFilter);
} }
render() { render() {
if (!this.props.socketOpen) { if (!this.props.socketOpen || this.props.isLocked) {
// TODO: return something when disconnected // TODO: return something when disconnected
return null; return null;
} }

View File

@ -1,7 +1,6 @@
import Settings from '/imports/ui/services/settings'; import Settings from '/imports/ui/services/settings';
import mapUser from '/imports/ui/services/user/mapUser'; import mapUser from '/imports/ui/services/user/mapUser';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings/';
import Users from '/imports/api/users/'; import Users from '/imports/api/users/';
import VideoService from '../service'; import VideoService from '../service';
@ -19,10 +18,8 @@ const isDisabled = () => {
const videoSettings = Settings.dataSaving; const videoSettings = Settings.dataSaving;
const enableShare = !videoSettings.viewParticipantsWebcams; const enableShare = !videoSettings.viewParticipantsWebcams;
const meeting = Meetings.findOne({ meetingId: Auth.meetingID }); const LockCam = VideoService.isLocked()
const LockCam = meeting.lockSettingsProp ? meeting.lockSettingsProp.disableCam : false; const webcamOnlyModerator = VideoService.webcamOnlyModerator();
const webcamOnlyModerator = meeting.usersProp.webcamsOnlyForModerator;
const user = Users.findOne({ userId: Auth.userID }); const user = Users.findOne({ userId: Auth.userID });
const userLocked = mapUser(user).isLocked; const userLocked = mapUser(user).isLocked;