diff --git a/bigbluebutton-html5/imports/ui/components/video-preview/component.jsx b/bigbluebutton-html5/imports/ui/components/video-preview/component.jsx index 7a248885d2..5cd9989aab 100755 --- a/bigbluebutton-html5/imports/ui/components/video-preview/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/video-preview/component.jsx @@ -21,6 +21,7 @@ import { } from '/imports/ui/services/virtual-background/service'; import { getSettingsSingletonInstance } from '/imports/ui/services/settings'; import Checkbox from '/imports/ui/components/common/checkbox/component' +import AppService from '/imports/ui/components/app/service'; const VIEW_STATES = { finding: 'finding', @@ -48,9 +49,9 @@ const defaultProps = { }; const intlMessages = defineMessages({ - webcamEffectsTitle: { - id: 'app.videoPreview.webcamEffectsTitle', - description: 'Title for the video effects modal', + webcamVirtualBackgroundTitle: { + id: 'app.videoPreview.webcamVirtualBackgroundLabel', + description: 'Title for the virtual background modal', }, webcamSettingsTitle: { id: 'app.videoPreview.webcamSettingsTitle', @@ -60,6 +61,10 @@ const intlMessages = defineMessages({ id: 'app.videoPreview.closeLabel', description: 'Close button label', }, + cancelLabel: { + id: 'app.mobileAppModal.dismissLabel', + description: 'Close button label', + }, webcamPreviewLabel: { id: 'app.videoPreview.webcamPreviewLabel', description: 'Webcam preview label', @@ -227,11 +232,13 @@ class VideoPreview extends Component { this.handleVirtualBgSelected = this.handleVirtualBgSelected.bind(this); this.handleLocalStreamInactive = this.handleLocalStreamInactive.bind(this); this.handleBrightnessAreaChange = this.handleBrightnessAreaChange.bind(this); + this.handleSelectTab = this.handleSelectTab.bind(this); this._isMounted = false; this.state = { webcamDeviceId, + selectedTab: 0, availableWebcams: null, selectedProfile: null, isStartSharingDisabled: true, @@ -542,12 +549,12 @@ class VideoPreview extends Component { } handleProceed() { - const { resolve, closeModal, sharedDevices, isVisualEffects } = this.props; + const { resolve, closeModal, sharedDevices } = this.props; const { webcamDeviceId, brightness } = this.state; const shared = sharedDevices.includes(webcamDeviceId); if ( - (shared || isVisualEffects) + (shared) && this.currentVideoStream.virtualBgService && brightness === 100 && this.currentVideoStream.virtualBgType === EFFECT_TYPES.NONE_TYPE @@ -740,9 +747,7 @@ class VideoPreview extends Component { const { intl, sharedDevices, - isVisualEffects, cameraAsContent, - isVirtualBackgroundsEnabled, } = this.props; const { @@ -751,120 +756,95 @@ class VideoPreview extends Component { selectedProfile, } = this.state; - const shared = sharedDevices.includes(webcamDeviceId); - const shouldShowVirtualBackgrounds = isVirtualBackgroundsEnabled && !cameraAsContent; + return ( + + + {intl.formatMessage(intlMessages.cameraLabel)} + + { availableWebcams && availableWebcams.length > 0 + ? ( + + {availableWebcams.map((webcam, index) => ( + + ))} + + ) + : ( + + {intl.formatMessage(intlMessages.webcamNotFoundLabel)} + + ) + } + {this.renderQualitySelector()} + + ); + } + + renderQualitySelector() { + const { + intl, + cameraAsContent, + } = this.props + + const { + selectedProfile, + availableWebcams, + webcamDeviceId, + } = this.state; + + const shared = this.isAlreadyShared(webcamDeviceId); + + if (shared) { + return ( + + {intl.formatMessage(intlMessages.sharedCameraLabel)} + + ); + } + + if (cameraAsContent) return; const CAMERA_PROFILES = window.meetingClientSettings.public.kurento.cameraProfiles || []; // Filtered, without hidden profiles const PREVIEW_CAMERA_PROFILES = CAMERA_PROFILES.filter(p => !p.hidden); - if (isVisualEffects) { - return ( - <> - {isVirtualBackgroundsEnabled && this.renderVirtualBgSelector()} - - ); - } - return ( <> + + {intl.formatMessage(intlMessages.qualityLabel)} + + {PREVIEW_CAMERA_PROFILES.length > 0 + ? ( + + {PREVIEW_CAMERA_PROFILES.map((profile) => { + const label = intlMessages[`${profile.id}`] + ? intl.formatMessage(intlMessages[`${profile.id}`]) + : profile.name; - { cameraAsContent - ? ( - <> - - {intl.formatMessage(intlMessages.cameraLabel)} - - { availableWebcams && availableWebcams.length > 0 - ? ( - - {availableWebcams.map((webcam, index) => ( - - ))} - - ) - : ( - - {intl.formatMessage(intlMessages.webcamNotFoundLabel)} - - ) - } - - ) - : - <> - - {intl.formatMessage(intlMessages.cameraLabel)} - - { availableWebcams && availableWebcams.length > 0 - ? ( - - {availableWebcams.map((webcam, index) => ( - - ))} - - ) - : ( - - {intl.formatMessage(intlMessages.webcamNotFoundLabel)} - - ) - } - { shared - ? ( - - {intl.formatMessage(intlMessages.sharedCameraLabel)} - - ) - : ( - <> - - {intl.formatMessage(intlMessages.qualityLabel)} - - {PREVIEW_CAMERA_PROFILES.length > 0 - ? ( - - {PREVIEW_CAMERA_PROFILES.map((profile) => { - const label = intlMessages[`${profile.id}`] - ? intl.formatMessage(intlMessages[`${profile.id}`]) - : profile.name; - - return ( - - ); - })} - - ) - : ( - - {intl.formatMessage(intlMessages.profileNotFoundLabel)} - - ) - } - - ) - } - {shouldShowVirtualBackgrounds && this.renderVirtualBgSelector()} - - } + ); + })} + + ) + : ( + + {intl.formatMessage(intlMessages.profileNotFoundLabel)} + + ) + } ); } @@ -878,6 +858,7 @@ class VideoPreview extends Component { renderBrightnessInput() { const { cameraAsContent, + cameraAsContentDeviceId, } = this.props; const { webcamDeviceId, @@ -896,10 +877,10 @@ class VideoPreview extends Component { ? (brightness * 100) / 200 : ((200 - brightness) * 100) / 200; - if(cameraAsContent){ return null } + if(cameraAsContent || webcamDeviceId === cameraAsContentDeviceId){ return null } return ( - <> + {intl.formatMessage(intlMessages.brightness)} @@ -947,12 +928,12 @@ class VideoPreview extends Component { label={intl.formatMessage(intlMessages.wholeImageBrightnessLabel)} /> - + ); } renderVirtualBgSelector() { - const { isVisualEffects, isCustomVirtualBackgroundsEnabled } = this.props; + const { isCustomVirtualBackgroundsEnabled } = this.props; const { isStartSharingDisabled, webcamDeviceId } = this.state; const initialVirtualBgState = this.currentVideoStream ? { type: this.currentVideoStream.virtualBgType, @@ -969,13 +950,37 @@ class VideoPreview extends Component { locked={isStartSharingDisabled} showThumbnails={SHOW_THUMBNAILS} initialVirtualBgState={initialVirtualBgState} - isVisualEffects={isVisualEffects} isCustomVirtualBackgroundsEnabled={isCustomVirtualBackgroundsEnabled} /> ); } - renderContent() { + renderTabsContent(tabNumber) { + const { + cameraAsContent, + isVirtualBackgroundsEnabled, + } = this.props; + + const shouldShowVirtualBackgrounds = isVirtualBackgroundsEnabled && !cameraAsContent; + + return ( + + {tabNumber === 0 && ( + + {this.renderDeviceSelectors()} + {this.renderBrightnessInput()} + + )} + {tabNumber === 1 && shouldShowVirtualBackgrounds && ( + + {this.renderVirtualBgSelector()} + + )} + + ); + } + + renderContent(selectedTab) { const { intl, } = this.props; @@ -989,12 +994,20 @@ class VideoPreview extends Component { const Settings = getSettingsSingletonInstance(); const { animations } = Settings.application; + const containerStyle = { + width: '60%', + height: '25vh', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + }; + switch (viewState) { case VIEW_STATES.finding: return ( -
+
{intl.formatMessage(intlMessages.findingWebcamsLabel)}
@@ -1030,10 +1043,7 @@ class VideoPreview extends Component { ) } - - {this.renderDeviceSelectors()} - {this.renderBrightnessInput()} - + {this.renderTabsContent(selectedTab)} ); } @@ -1045,13 +1055,13 @@ class VideoPreview extends Component { return intl.formatMessage(intlMessages.webcamSettingsTitle); } - renderModalContent() { + renderModalContent(selectedTab) { const { intl, hasVideoStream, forceOpen, camCapReached, - isVisualEffects, + closeModal, } = this.props; const { @@ -1066,6 +1076,8 @@ class VideoPreview extends Component { const shared = this.isAlreadyShared(webcamDeviceId); + const showStopAllButton = hasVideoStream && VideoService.isMultipleCamerasEnabled(); + const { isIe } = browserInfo; return ( @@ -1083,50 +1095,72 @@ class VideoPreview extends Component { ) : null} - {this.renderContent()} + {this.renderContent(selectedTab)} - {!isVisualEffects ? ( - - {hasVideoStream && VideoService.isMultipleCamerasEnabled() - ? ( + + + + {showStopAllButton ? ( -