Merge pull request #8157 from capilkey/viewer-webcam-lock-unshare
Viewer webcam lock unshare
This commit is contained in:
commit
3dd4761889
@ -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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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(),
|
||||||
|
Loading…
Reference in New Issue
Block a user