bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-preview/container.jsx
prlanzarin 9071ba8bc4 refactor(virtual-backgrounds): re-organize virtual background code
Changes (maybe not a complete list):
  - Disable virtualbgs by default
  - Move the virtualbg selector in video-preview to the side below the
profile selection
  - Restore old video-preview sizes
  - Add a wrapper class for MediaStreams (BBBVideoStream)
  - Centralize virtualbg services and business logic code into BBBVideoStream
  - Refactor and centralize virtualbg constant fetching
  - Refactor and centralize virtualbg config fetching
  - Organize virtualbg type definitions
  - Remove added states in video-provider to prevent further bloat
  - Remove added states in video-preview to prevent further bloat
  - Lock virtual bg switching while video-preview itself is locked
  - Add proper virtualbg error surfacing via toasts
  - Refactor iOS availability detection to use centralized UA checker
  - Avoid calling gUM when toggling virtualbgs on/off
  - Make virtualbg video-list-item action a toggle instead of a
state-aware action
  - Make virtualbg switching work in video-preview for cameras that are
already shared. Especially useful when there are multiple source
cameras, and will be important in the near future
  - Add Derivative Work notices in files that are partially copied from
jitsi-meet
  - Simplify track replacing in video-provider
  - Split video-preview UI code for virtualbgs into a separate functional component
2021-07-22 18:53:42 +00:00

49 lines
1.6 KiB
JavaScript
Executable File

import React from 'react';
import { withModalMounter } from '/imports/ui/components/modal/service';
import { withTracker } from 'meteor/react-meteor-data';
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';
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 }) => ({
startSharing: (deviceId) => {
mountModal(null);
VideoService.joinVideo(deviceId);
},
stopSharing: (deviceId) => {
mountModal(null);
if (deviceId) {
const streamId = VideoService.getMyStreamId(deviceId);
if (streamId) VideoService.stopVideo(streamId);
} else {
VideoService.exitVideo();
}
},
sharedDevices: VideoService.getSharedDevices(),
isCamLocked: isCamLocked(),
closeModal: () => mountModal(null),
webcamDeviceId: Service.webcamDeviceId(),
hasVideoStream: VideoService.hasVideoStream(),
}))(VideoPreviewContainer));