Merge pull request #9481 from KDSBrowne/issue-9450

Close video preview modal when "share webcam" lock activated
This commit is contained in:
Anton Georgiev 2020-05-11 14:38:20 -04:00 committed by GitHub
commit 29f5154fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 7 deletions

View File

@ -412,7 +412,6 @@ class VideoPreview extends Component {
});
this.video.srcObject = stream;
this.deviceStream = stream;
}).catch((error) => {
logger.warn({
logCode: 'video_preview_do_gum_preview_error',
@ -451,7 +450,7 @@ class VideoPreview extends Component {
renderDeviceSelectors() {
const {
intl,
skipVideoPreview
skipVideoPreview,
} = this.props;
const {
@ -543,11 +542,11 @@ class VideoPreview extends Component {
</div>
);
case VIEW_STATES.error:
return (
<div className={styles.content}>
<div className={styles.videoCol}><div>{deviceError}</div></div>
</div>
);
return (
<div className={styles.content}>
<div className={styles.videoCol}><div>{deviceError}</div></div>
</div>
);
case VIEW_STATES.found:
default:
return (
@ -632,7 +631,14 @@ class VideoPreview extends Component {
intl,
hasMediaDevices,
skipVideoPreview,
isCamLocked,
} = this.props;
if (isCamLocked === true) {
this.handleProceed();
return null;
}
const {
deviceError,
previewError,

View File

@ -3,6 +3,9 @@ import { withModalMounter } from '/imports/ui/components/modal/service';
import { withTracker } from 'meteor/react-meteor-data';
import deviceInfo from '/imports/utils/deviceInfo';
import getFromUserSettings from '/imports/ui/services/users-settings';
import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings';
import Auth from '/imports/ui/services/auth';
import Service from './service';
import VideoPreview from './component';
import VideoService from '../video-provider/service';
@ -13,11 +16,28 @@ const SKIP_VIDEO_PREVIEW = KURENTO_CONFIG.skipVideoPreview;
const VideoPreviewContainer = props => <VideoPreview {...props} />;
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const isCamLocked = () => {
const meeting = Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { 'lockSettingsProps.disableCam': 1 } });
const user = Users.findOne({ meetingId: Auth.meetingID, userId: Auth.userID },
{ fields: { locked: 1, role: 1 } });
if (meeting.lockSettingsProps !== undefined) {
if (user.locked && user.role !== ROLE_MODERATOR) {
return meeting.lockSettingsProps.disableCam;
}
}
return false;
};
export default withModalMounter(withTracker(({ mountModal, fromInterface }) => ({
startSharing: () => {
mountModal(null);
VideoService.joinVideo();
},
isCamLocked: isCamLocked(),
closeModal: () => mountModal(null),
changeWebcam: deviceId => Service.changeWebcam(deviceId),
webcamDeviceId: Service.webcamDeviceId(),