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

View File

@ -1,6 +1,7 @@
import { Tracker } from 'meteor/tracker';
import { makeCall } from '/imports/ui/services/api';
import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings/';
import Auth from '/imports/ui/services/auth';
class VideoService {
@ -69,6 +70,16 @@ class VideoService {
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() {
return Auth.userID;
}
@ -93,6 +104,8 @@ export default {
exitingVideo: () => videoService.exitingVideo(),
exitedVideo: () => videoService.exitedVideo(),
getAllUsers: () => videoService.getAllUsers(),
webcamOnlyModerator: () => videoService.webcamOnlyModerator(),
isLocked: () => videoService.isLocked(),
isConnected: () => videoService.isConnected,
isWaitingResponse: () => videoService.isWaitingResponse,
joinVideo: () => videoService.joinVideo(),

View File

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

View File

@ -1,7 +1,6 @@
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';
@ -19,10 +18,8 @@ const isDisabled = () => {
const videoSettings = Settings.dataSaving;
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 LockCam = VideoService.isLocked()
const webcamOnlyModerator = VideoService.webcamOnlyModerator();
const user = Users.findOne({ userId: Auth.userID });
const userLocked = mapUser(user).isLocked;