Merge pull request #8157 from capilkey/viewer-webcam-lock-unshare

Viewer webcam lock unshare
This commit is contained in:
Chad Pilkey 2019-09-27 18:20:26 -04:00 committed by GitHub
commit 3dd4761889
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import {
newWebcamConnection, newWebcamConnection,
updateWebcamStats, updateWebcamStats,
} from '/imports/ui/services/network-information/index'; } from '/imports/ui/services/network-information/index';
import { tryGenerateIceCandidates } from '../../../utils/safari-webrtc'; import { tryGenerateIceCandidates } from '../../../utils/safari-webrtc';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
@ -115,6 +116,8 @@ const propTypes = {
userId: PropTypes.string.isRequired, userId: PropTypes.string.isRequired,
intl: PropTypes.objectOf(Object).isRequired, intl: PropTypes.objectOf(Object).isRequired,
enableVideoStats: PropTypes.bool.isRequired, enableVideoStats: PropTypes.bool.isRequired,
userIsLocked: PropTypes.bool.isRequired,
userHasStream: PropTypes.bool.isRequired,
}; };
class VideoProvider extends Component { class VideoProvider extends Component {
@ -256,7 +259,12 @@ class VideoProvider extends Component {
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { users } = this.props; const {
users,
userIsLocked,
userHasStream,
} = this.props;
if (!prevProps.userIsLocked && userIsLocked && userHasStream) VideoService.exitVideo();
if (users.length !== prevProps.users.length) window.dispatchEvent(new Event('videoListUsersChange')); if (users.length !== prevProps.users.length) window.dispatchEvent(new Event('videoListUsersChange'));
} }

View File

@ -1,10 +1,13 @@
import React from 'react'; import React from 'react';
import { withTracker } from 'meteor/react-meteor-data'; import { withTracker } from 'meteor/react-meteor-data';
import getFromUserSettings from '/imports/ui/services/users-settings'; import getFromUserSettings from '/imports/ui/services/users-settings';
import Users from '/imports/api/users';
import VideoStreams from '/imports/api/video-streams';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import VideoProvider from './component'; import VideoProvider from './component';
import VideoService from './service'; import VideoService from './service';
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const VideoProviderContainer = ({ children, ...props }) => { const VideoProviderContainer = ({ children, ...props }) => {
const { users } = props; const { users } = props;
return (!users.length ? null : <VideoProvider {...props}>{children}</VideoProvider>); return (!users.length ? null : <VideoProvider {...props}>{children}</VideoProvider>);
@ -16,6 +19,12 @@ export default withTracker(props => ({
meetingId: VideoService.meetingId(), meetingId: VideoService.meetingId(),
users: VideoService.getAllWebcamUsers(), users: VideoService.getAllWebcamUsers(),
userId: Auth.userID, userId: Auth.userID,
userIsLocked: !!Users.findOne({
userId: Auth.userID,
locked: true,
role: { $ne: ROLE_MODERATOR },
}, { fields: {} }) && VideoService.webcamsLocked(),
userHasStream: !!VideoStreams.findOne({ userId: Auth.userID }, { fields: {} }),
sessionToken: VideoService.sessionToken(), sessionToken: VideoService.sessionToken(),
enableVideoStats: getFromUserSettings('enableVideoStats', Meteor.settings.public.kurento.enableVideoStats), enableVideoStats: getFromUserSettings('enableVideoStats', Meteor.settings.public.kurento.enableVideoStats),
voiceBridge: VideoService.voiceBridge(), voiceBridge: VideoService.voiceBridge(),