Merge pull request #8319 from Tainan404/issue-8297

Add Skip video preview
This commit is contained in:
Anton Georgiev 2019-11-20 14:53:07 -05:00 committed by GitHub
commit fc663a1547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 8 deletions

View File

@ -46,6 +46,7 @@ const currentParameters = [
'bbb_enable_screen_sharing',
'bbb_enable_video',
'bbb_enable_video_stats',
'bbb_skip_video_preview',
// WHITEBOARD
'bbb_multi_user_pen_only',
'bbb_presenter_tools',

View File

@ -185,11 +185,17 @@ class VideoPreview extends Component {
selectedProfile: null,
isStartSharingDisabled: true,
viewState: VIEW_STATES.finding,
deviceError: null,
previewError: null,
};
}
componentDidMount() {
const { webcamDeviceId, hasMediaDevices } = this.props;
const {
webcamDeviceId,
hasMediaDevices,
skipVideoPreview,
} = this.props;
this._isMounted = true;
@ -244,9 +250,11 @@ class VideoPreview extends Component {
});
this.displayInitialPreview(initialDeviceId);
}
this.setState({
viewState: VIEW_STATES.found,
});
if (!skipVideoPreview) {
this.setState({
viewState: VIEW_STATES.found,
});
}
}).catch((error) => {
logger.warn({
logCode: 'video_preview_enumerate_error',
@ -383,7 +391,10 @@ class VideoPreview extends Component {
}
displayPreview(deviceId, profile) {
const { changeProfile } = this.props;
const {
changeProfile,
skipVideoPreview,
} = this.props;
this.setState({
selectedProfile: profile.id,
@ -391,6 +402,7 @@ class VideoPreview extends Component {
previewError: undefined,
});
changeProfile(profile.id);
if (skipVideoPreview) return this.handleStartSharing();
this.doGUM(deviceId, profile).then((stream) => {
if (!this._isMounted) return;
@ -400,6 +412,7 @@ class VideoPreview extends Component {
});
this.video.srcObject = stream;
this.deviceStream = stream;
}).catch((error) => {
logger.warn({
logCode: 'video_preview_do_gum_preview_error',
@ -438,6 +451,7 @@ class VideoPreview extends Component {
renderDeviceSelectors() {
const {
intl,
skipVideoPreview
} = this.props;
const {
@ -460,6 +474,7 @@ class VideoPreview extends Component {
value={webcamDeviceId || ''}
className={styles.select}
onChange={this.handleSelectWebcam}
disabled={skipVideoPreview}
>
{availableWebcams.map(webcam => (
<option key={webcam.deviceId} value={webcam.deviceId}>
@ -485,6 +500,7 @@ class VideoPreview extends Component {
value={selectedProfile || ''}
className={styles.select}
onChange={this.handleSelectProfile}
disabled={skipVideoPreview}
>
{availableProfiles.map(profile => (
<option key={profile.id} value={profile.id}>
@ -563,12 +579,15 @@ class VideoPreview extends Component {
renderModalContent() {
const {
intl,
skipVideoPreview,
} = this.props;
const {
isStartSharingDisabled,
deviceError,
previewError,
} = this.state;
const shouldDisableButtons = skipVideoPreview && !(deviceError || previewError);
return (
<div>
{browser().name === 'edge' || browser().name === 'ie' ? (
@ -594,12 +613,13 @@ class VideoPreview extends Component {
<Button
label={intl.formatMessage(intlMessages.cancelLabel)}
onClick={this.handleProceed}
disabled={shouldDisableButtons}
/>
<Button
color="primary"
label={intl.formatMessage(intlMessages.startSharingLabel)}
onClick={this.handleStartSharing}
disabled={isStartSharingDisabled || isStartSharingDisabled === null}
disabled={isStartSharingDisabled || isStartSharingDisabled === null || shouldDisableButtons}
/>
</div>
</div>
@ -611,7 +631,14 @@ class VideoPreview extends Component {
const {
intl,
hasMediaDevices,
skipVideoPreview,
} = this.props;
const {
deviceError,
previewError,
} = this.state;
const allowCloseModal = !!(deviceError || previewError) || !skipVideoPreview;
return (
<Modal
@ -620,6 +647,8 @@ class VideoPreview extends Component {
onRequestClose={this.handleProceed}
hideBorder
contentLabel={intl.formatMessage(intlMessages.webcamSettingsTitle)}
shouldShowCloseButton={allowCloseModal}
shouldCloseOnOverlayClick={allowCloseModal}
>
{hasMediaDevices
? this.renderModalContent()

View File

@ -7,7 +7,9 @@ import Service from './service';
import VideoPreview from './component';
import VideoService from '../video-provider/service';
const CAMERA_PROFILES = Meteor.settings.public.kurento.cameraProfiles;
const KURENTO_CONFIG = Meteor.settings.public.kurento;
const CAMERA_PROFILES = KURENTO_CONFIG.cameraProfiles;
const SKIP_VIDEO_PREVIEW = KURENTO_CONFIG.skipVideoPreview;
const VideoPreviewContainer = props => <VideoPreview {...props} />;
@ -22,4 +24,5 @@ export default withModalMounter(withTracker(({ mountModal }) => ({
changeProfile: profileId => Service.changeProfile(profileId),
hasMediaDevices: deviceInfo.hasMediaDevices,
userParameterProfile: getFromUserSettings('bbb_preferred_camera_profile', (CAMERA_PROFILES.filter(i => i.default) || {}).id),
skipVideoPreview: getFromUserSettings('bbb_skip_video_preview', false) || SKIP_VIDEO_PREVIEW,
}))(VideoPreviewContainer));

View File

@ -118,6 +118,7 @@ public:
enableVideoMenu: true
enableListenOnly: true
autoShareWebcam: false
skipVideoPreview: false
pingPong:
clearUsersInSeconds: 30
pongTimeInSeconds: 15