2017-09-26 04:28:36 +08:00
|
|
|
import React, { Component } from 'react';
|
2017-10-11 02:03:29 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2019-04-19 02:48:39 +08:00
|
|
|
import { Session } from 'meteor/session';
|
2019-03-29 05:53:42 +08:00
|
|
|
import {
|
2020-05-26 04:00:13 +08:00
|
|
|
defineMessages, injectIntl, FormattedMessage,
|
2019-03-29 05:53:42 +08:00
|
|
|
} from 'react-intl';
|
2021-11-09 21:22:59 +08:00
|
|
|
import Styled from './styles';
|
2017-11-09 02:41:15 +08:00
|
|
|
import PermissionsOverlay from '../permissions-overlay/component';
|
2017-03-25 00:01:35 +08:00
|
|
|
import AudioSettings from '../audio-settings/component';
|
2017-10-04 04:42:10 +08:00
|
|
|
import EchoTest from '../echo-test/component';
|
2017-11-17 19:52:48 +08:00
|
|
|
import Help from '../help/component';
|
2019-04-11 04:51:06 +08:00
|
|
|
import AudioDial from '../audio-dial/component';
|
2019-08-03 05:32:42 +08:00
|
|
|
import AudioAutoplayPrompt from '../autoplay/component';
|
2021-11-09 21:22:59 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
2018-12-03 14:01:19 +08:00
|
|
|
|
2017-10-11 02:03:29 +08:00
|
|
|
const propTypes = {
|
2021-08-09 22:24:02 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2017-10-11 02:03:29 +08:00
|
|
|
closeModal: PropTypes.func.isRequired,
|
|
|
|
joinMicrophone: PropTypes.func.isRequired,
|
|
|
|
joinListenOnly: PropTypes.func.isRequired,
|
|
|
|
joinEchoTest: PropTypes.func.isRequired,
|
|
|
|
exitAudio: PropTypes.func.isRequired,
|
|
|
|
leaveEchoTest: PropTypes.func.isRequired,
|
|
|
|
changeInputDevice: PropTypes.func.isRequired,
|
|
|
|
changeOutputDevice: PropTypes.func.isRequired,
|
|
|
|
isEchoTest: PropTypes.bool.isRequired,
|
|
|
|
isConnecting: PropTypes.bool.isRequired,
|
|
|
|
isConnected: PropTypes.bool.isRequired,
|
2021-04-30 05:03:18 +08:00
|
|
|
isUsingAudio: PropTypes.bool.isRequired,
|
2017-10-23 20:41:09 +08:00
|
|
|
inputDeviceId: PropTypes.string,
|
|
|
|
outputDeviceId: PropTypes.string,
|
2019-04-16 00:39:36 +08:00
|
|
|
formattedDialNum: PropTypes.string.isRequired,
|
2018-03-02 20:01:34 +08:00
|
|
|
showPermissionsOvelay: PropTypes.bool.isRequired,
|
2022-04-12 04:18:43 +08:00
|
|
|
localEchoEnabled: PropTypes.bool.isRequired,
|
2018-03-02 20:01:34 +08:00
|
|
|
listenOnlyMode: PropTypes.bool.isRequired,
|
2021-02-05 02:42:31 +08:00
|
|
|
joinFullAudioImmediately: PropTypes.bool,
|
2018-03-06 04:00:52 +08:00
|
|
|
forceListenOnlyAttendee: PropTypes.bool.isRequired,
|
2019-06-28 00:02:42 +08:00
|
|
|
audioLocked: PropTypes.bool.isRequired,
|
2019-07-19 22:45:04 +08:00
|
|
|
resolve: PropTypes.func,
|
2019-06-28 00:02:42 +08:00
|
|
|
isMobileNative: PropTypes.bool.isRequired,
|
2021-04-03 02:11:46 +08:00
|
|
|
isIE: PropTypes.bool.isRequired,
|
2019-06-28 00:02:42 +08:00
|
|
|
formattedTelVoice: PropTypes.string.isRequired,
|
2019-08-03 05:32:42 +08:00
|
|
|
autoplayBlocked: PropTypes.bool.isRequired,
|
|
|
|
handleAllowAutoplay: PropTypes.func.isRequired,
|
2017-10-23 20:41:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
|
|
|
inputDeviceId: null,
|
|
|
|
outputDeviceId: null,
|
2019-07-19 22:45:04 +08:00
|
|
|
resolve: null,
|
2021-02-05 02:42:31 +08:00
|
|
|
joinFullAudioImmediately: false,
|
2017-10-11 02:03:29 +08:00
|
|
|
};
|
2017-09-26 04:28:36 +08:00
|
|
|
|
2017-10-11 02:03:29 +08:00
|
|
|
const intlMessages = defineMessages({
|
2017-09-26 04:28:36 +08:00
|
|
|
microphoneLabel: {
|
|
|
|
id: 'app.audioModal.microphoneLabel',
|
|
|
|
description: 'Join mic audio button label',
|
|
|
|
},
|
|
|
|
listenOnlyLabel: {
|
|
|
|
id: 'app.audioModal.listenOnlyLabel',
|
|
|
|
description: 'Join listen only audio button label',
|
|
|
|
},
|
2021-08-11 11:23:39 +08:00
|
|
|
listenOnlyDesc: {
|
|
|
|
id: 'app.audioModal.listenOnlyDesc',
|
|
|
|
description: 'Join listen only audio button description',
|
|
|
|
},
|
|
|
|
microphoneDesc: {
|
|
|
|
id: 'app.audioModal.microphoneDesc',
|
|
|
|
description: 'Join mic audio button description',
|
|
|
|
},
|
2017-09-26 04:28:36 +08:00
|
|
|
closeLabel: {
|
|
|
|
id: 'app.audioModal.closeLabel',
|
|
|
|
description: 'close audio modal button label',
|
|
|
|
},
|
|
|
|
audioChoiceLabel: {
|
|
|
|
id: 'app.audioModal.audioChoiceLabel',
|
|
|
|
description: 'Join audio modal title',
|
|
|
|
},
|
2018-05-25 03:39:17 +08:00
|
|
|
iOSError: {
|
|
|
|
id: 'app.audioModal.iOSBrowser',
|
|
|
|
description: 'Audio/Video Not supported warning',
|
|
|
|
},
|
|
|
|
iOSErrorDescription: {
|
|
|
|
id: 'app.audioModal.iOSErrorDescription',
|
|
|
|
description: 'Audio/Video not supported description',
|
|
|
|
},
|
|
|
|
iOSErrorRecommendation: {
|
|
|
|
id: 'app.audioModal.iOSErrorRecommendation',
|
|
|
|
description: 'Audio/Video recommended action',
|
|
|
|
},
|
2017-10-11 02:03:29 +08:00
|
|
|
echoTestTitle: {
|
|
|
|
id: 'app.audioModal.echoTestTitle',
|
|
|
|
description: 'Title for the echo test',
|
|
|
|
},
|
|
|
|
settingsTitle: {
|
|
|
|
id: 'app.audioModal.settingsTitle',
|
|
|
|
description: 'Title for the audio modal',
|
|
|
|
},
|
2017-11-17 19:52:48 +08:00
|
|
|
helpTitle: {
|
|
|
|
id: 'app.audioModal.helpTitle',
|
|
|
|
description: 'Title for the audio help',
|
|
|
|
},
|
2019-04-11 04:51:06 +08:00
|
|
|
audioDialTitle: {
|
|
|
|
id: 'app.audioModal.audioDialTitle',
|
|
|
|
description: 'Title for the audio dial',
|
|
|
|
},
|
2017-10-11 02:03:29 +08:00
|
|
|
connecting: {
|
|
|
|
id: 'app.audioModal.connecting',
|
|
|
|
description: 'Message for audio connecting',
|
|
|
|
},
|
2019-05-08 21:16:00 +08:00
|
|
|
ariaModalTitle: {
|
|
|
|
id: 'app.audioModal.ariaTitle',
|
|
|
|
description: 'aria label for modal title',
|
|
|
|
},
|
2019-08-03 05:32:42 +08:00
|
|
|
autoplayPromptTitle: {
|
|
|
|
id: 'app.audioModal.autoplayBlockedDesc',
|
|
|
|
description: 'Message for autoplay audio block',
|
|
|
|
},
|
2017-09-26 04:28:36 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
class AudioModal extends Component {
|
2016-11-16 05:00:28 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
this.state = {
|
2017-10-11 02:03:29 +08:00
|
|
|
content: null,
|
2018-03-20 20:09:45 +08:00
|
|
|
hasError: false,
|
2019-09-27 21:52:29 +08:00
|
|
|
errCode: null,
|
2017-09-26 04:28:36 +08:00
|
|
|
};
|
2016-11-16 05:00:28 +08:00
|
|
|
|
2017-10-04 04:42:10 +08:00
|
|
|
this.handleGoToAudioOptions = this.handleGoToAudioOptions.bind(this);
|
2017-09-29 21:38:10 +08:00
|
|
|
this.handleGoToAudioSettings = this.handleGoToAudioSettings.bind(this);
|
2018-04-24 22:52:37 +08:00
|
|
|
this.handleRetryGoToEchoTest = this.handleRetryGoToEchoTest.bind(this);
|
2017-10-04 04:42:10 +08:00
|
|
|
this.handleGoToEchoTest = this.handleGoToEchoTest.bind(this);
|
2017-10-12 22:49:50 +08:00
|
|
|
this.handleJoinMicrophone = this.handleJoinMicrophone.bind(this);
|
2022-04-05 05:09:35 +08:00
|
|
|
this.handleJoinSimplifiedEcho = this.handleJoinSimplifiedEcho.bind(this);
|
2017-11-17 19:52:48 +08:00
|
|
|
this.handleJoinListenOnly = this.handleJoinListenOnly.bind(this);
|
2018-03-20 20:09:45 +08:00
|
|
|
this.skipAudioOptions = this.skipAudioOptions.bind(this);
|
2017-10-04 04:42:10 +08:00
|
|
|
|
|
|
|
this.contents = {
|
2017-10-11 02:03:29 +08:00
|
|
|
echoTest: {
|
2019-03-26 06:43:25 +08:00
|
|
|
title: intlMessages.echoTestTitle,
|
2017-10-11 02:03:29 +08:00
|
|
|
component: () => this.renderEchoTest(),
|
|
|
|
},
|
|
|
|
settings: {
|
2019-03-26 06:43:25 +08:00
|
|
|
title: intlMessages.settingsTitle,
|
2017-10-11 02:03:29 +08:00
|
|
|
component: () => this.renderAudioSettings(),
|
|
|
|
},
|
2017-11-17 19:52:48 +08:00
|
|
|
help: {
|
2019-03-26 06:43:25 +08:00
|
|
|
title: intlMessages.helpTitle,
|
2017-11-17 19:52:48 +08:00
|
|
|
component: () => this.renderHelp(),
|
2018-03-02 20:01:34 +08:00
|
|
|
},
|
2019-04-11 04:51:06 +08:00
|
|
|
audioDial: {
|
|
|
|
title: intlMessages.audioDialTitle,
|
|
|
|
component: () => this.renderAudioDial(),
|
|
|
|
},
|
2019-08-03 05:32:42 +08:00
|
|
|
autoplayBlocked: {
|
|
|
|
title: intlMessages.autoplayPromptTitle,
|
|
|
|
component: () => this.renderAutoplayOverlay(),
|
|
|
|
},
|
2017-10-04 04:42:10 +08:00
|
|
|
};
|
2019-08-03 05:32:42 +08:00
|
|
|
this.failedMediaElements = [];
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
|
|
|
|
2019-04-19 02:48:39 +08:00
|
|
|
componentDidMount() {
|
2018-03-06 04:00:52 +08:00
|
|
|
const {
|
|
|
|
forceListenOnlyAttendee,
|
2021-03-11 05:43:14 +08:00
|
|
|
joinFullAudioImmediately,
|
|
|
|
listenOnlyMode,
|
2019-01-24 00:06:14 +08:00
|
|
|
audioLocked,
|
2021-04-30 05:03:18 +08:00
|
|
|
isUsingAudio,
|
2018-03-06 04:00:52 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2021-04-30 05:03:18 +08:00
|
|
|
if (!isUsingAudio) {
|
2021-06-10 20:14:51 +08:00
|
|
|
if (forceListenOnlyAttendee || audioLocked) return this.handleJoinListenOnly();
|
2021-04-30 05:03:18 +08:00
|
|
|
|
2021-06-10 20:14:51 +08:00
|
|
|
if (joinFullAudioImmediately && !listenOnlyMode) return this.handleJoinMicrophone();
|
2022-01-11 21:59:46 +08:00
|
|
|
|
|
|
|
if (!listenOnlyMode) return this.handleGoToEchoTest();
|
2021-04-30 05:03:18 +08:00
|
|
|
}
|
2021-08-09 22:24:02 +08:00
|
|
|
return false;
|
2018-03-02 20:01:34 +08:00
|
|
|
}
|
|
|
|
|
2019-08-03 05:32:42 +08:00
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
const { autoplayBlocked, closeModal } = this.props;
|
2020-03-03 04:49:15 +08:00
|
|
|
|
2019-08-03 05:32:42 +08:00
|
|
|
if (autoplayBlocked !== prevProps.autoplayBlocked) {
|
2021-08-09 22:24:02 +08:00
|
|
|
if (autoplayBlocked) {
|
2021-09-04 04:54:28 +08:00
|
|
|
this.setContent({ content: 'autoplayBlocked' });
|
2021-08-09 22:24:02 +08:00
|
|
|
} else {
|
|
|
|
closeModal();
|
|
|
|
}
|
2019-08-03 05:32:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-10 04:48:10 +08:00
|
|
|
componentWillUnmount() {
|
|
|
|
const {
|
|
|
|
isEchoTest,
|
2019-01-18 00:33:43 +08:00
|
|
|
exitAudio,
|
2019-05-08 03:49:32 +08:00
|
|
|
resolve,
|
2017-10-10 04:48:10 +08:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (isEchoTest) {
|
2019-01-18 00:33:43 +08:00
|
|
|
exitAudio();
|
2017-10-10 04:48:10 +08:00
|
|
|
}
|
2019-05-08 03:49:32 +08:00
|
|
|
if (resolve) resolve();
|
2019-04-19 02:48:39 +08:00
|
|
|
Session.set('audioModalIsOpen', false);
|
2017-10-10 04:48:10 +08:00
|
|
|
}
|
|
|
|
|
2017-10-04 04:42:10 +08:00
|
|
|
handleGoToAudioOptions() {
|
2017-09-26 04:28:36 +08:00
|
|
|
this.setState({
|
2017-10-04 04:42:10 +08:00
|
|
|
content: null,
|
2018-03-20 20:09:45 +08:00
|
|
|
hasError: true,
|
2019-11-23 05:55:26 +08:00
|
|
|
disableActions: false,
|
2017-09-26 04:28:36 +08:00
|
|
|
});
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
|
|
|
|
2017-09-29 21:38:10 +08:00
|
|
|
handleGoToAudioSettings() {
|
2019-01-18 00:33:43 +08:00
|
|
|
const { leaveEchoTest } = this.props;
|
|
|
|
leaveEchoTest().then(() => {
|
2017-10-05 04:49:11 +08:00
|
|
|
this.setState({
|
|
|
|
content: 'settings',
|
|
|
|
});
|
2017-10-10 04:48:10 +08:00
|
|
|
});
|
2017-10-04 04:42:10 +08:00
|
|
|
}
|
|
|
|
|
2018-04-24 22:52:37 +08:00
|
|
|
handleRetryGoToEchoTest() {
|
|
|
|
this.setState({
|
|
|
|
hasError: false,
|
|
|
|
content: null,
|
|
|
|
});
|
|
|
|
|
|
|
|
return this.handleGoToEchoTest();
|
|
|
|
}
|
|
|
|
|
2022-04-12 04:18:43 +08:00
|
|
|
handleGoToLocalEcho() {
|
2022-04-05 05:09:35 +08:00
|
|
|
// Simplified echo test: this will return the AudioSettings with:
|
|
|
|
// - withEcho: true
|
|
|
|
// Echo test will be local and done in the AudioSettings view instead of the
|
|
|
|
// old E2E -> yes/no -> join view
|
|
|
|
this.setState({
|
|
|
|
content: 'settings',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-04 04:42:10 +08:00
|
|
|
handleGoToEchoTest() {
|
2019-10-01 22:28:06 +08:00
|
|
|
const { AudioError } = this.props;
|
|
|
|
const { MIC_ERROR } = AudioError;
|
|
|
|
const noSSL = !window.location.protocol.includes('https');
|
|
|
|
|
|
|
|
if (noSSL) {
|
|
|
|
return this.setState({
|
|
|
|
content: 'help',
|
|
|
|
errCode: MIC_ERROR.NO_SSL,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-11-17 19:52:48 +08:00
|
|
|
const {
|
2019-01-18 00:33:43 +08:00
|
|
|
joinEchoTest,
|
2020-11-17 02:57:25 +08:00
|
|
|
isConnecting,
|
2022-04-12 04:18:43 +08:00
|
|
|
localEchoEnabled
|
2017-11-17 19:52:48 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2019-11-23 05:55:26 +08:00
|
|
|
const {
|
|
|
|
disableActions,
|
|
|
|
} = this.state;
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
if (disableActions && isConnecting) return null;
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2022-04-12 04:18:43 +08:00
|
|
|
if (localEchoEnabled) return this.handleGoToLocalEcho();
|
2022-04-05 05:09:35 +08:00
|
|
|
|
2018-03-08 21:38:18 +08:00
|
|
|
this.setState({
|
2018-03-20 20:09:45 +08:00
|
|
|
hasError: false,
|
2019-11-23 05:55:26 +08:00
|
|
|
disableActions: true,
|
2018-03-08 21:38:18 +08:00
|
|
|
});
|
2018-03-06 04:00:52 +08:00
|
|
|
|
2019-01-18 00:33:43 +08:00
|
|
|
return joinEchoTest().then(() => {
|
2017-10-05 04:49:11 +08:00
|
|
|
this.setState({
|
|
|
|
content: 'echoTest',
|
2019-11-23 05:55:26 +08:00
|
|
|
disableActions: false,
|
2017-10-05 04:49:11 +08:00
|
|
|
});
|
2018-03-02 20:01:34 +08:00
|
|
|
}).catch((err) => {
|
2020-03-15 11:50:39 +08:00
|
|
|
const { type } = err;
|
|
|
|
switch (type) {
|
|
|
|
case 'MEDIA_ERROR':
|
|
|
|
this.setState({
|
|
|
|
content: 'help',
|
|
|
|
errCode: 0,
|
|
|
|
disableActions: false,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 'CONNECTION_ERROR':
|
|
|
|
this.setState({
|
|
|
|
errCode: 0,
|
|
|
|
disableActions: false,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this.setState({
|
|
|
|
errCode: 0,
|
|
|
|
disableActions: false,
|
|
|
|
});
|
|
|
|
break;
|
2017-11-17 19:52:48 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
handleJoinListenOnly() {
|
|
|
|
const {
|
|
|
|
joinListenOnly,
|
2021-05-18 03:37:46 +08:00
|
|
|
isConnecting,
|
2017-11-17 19:52:48 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2019-11-23 05:55:26 +08:00
|
|
|
const {
|
|
|
|
disableActions,
|
|
|
|
} = this.state;
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
if (disableActions && isConnecting) return null;
|
2019-11-23 05:55:26 +08:00
|
|
|
|
|
|
|
this.setState({
|
|
|
|
disableActions: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
return joinListenOnly().then(() => {
|
|
|
|
this.setState({
|
|
|
|
disableActions: false,
|
|
|
|
});
|
|
|
|
}).catch((err) => {
|
2017-11-17 19:52:48 +08:00
|
|
|
if (err.type === 'MEDIA_ERROR') {
|
|
|
|
this.setState({
|
|
|
|
content: 'help',
|
|
|
|
});
|
|
|
|
}
|
2017-10-10 04:48:10 +08:00
|
|
|
});
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
|
|
|
|
2022-04-05 05:09:35 +08:00
|
|
|
handleJoinSimplifiedEcho() {
|
|
|
|
// Reset the modal to a connecting state - this kind of sucks?
|
|
|
|
// FIXME - prlanzarin Apr 04 2022
|
|
|
|
this.setState({
|
|
|
|
content: null,
|
|
|
|
});
|
|
|
|
this.handleJoinMicrophone();
|
|
|
|
}
|
|
|
|
|
2017-10-12 22:49:50 +08:00
|
|
|
handleJoinMicrophone() {
|
|
|
|
const {
|
|
|
|
joinMicrophone,
|
2021-05-18 03:37:46 +08:00
|
|
|
isConnecting,
|
2017-10-12 22:49:50 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2019-11-23 05:55:26 +08:00
|
|
|
const {
|
|
|
|
disableActions,
|
|
|
|
} = this.state;
|
|
|
|
|
2021-05-18 03:37:46 +08:00
|
|
|
if (disableActions && isConnecting) return;
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2018-03-08 21:38:18 +08:00
|
|
|
this.setState({
|
2018-03-20 20:09:45 +08:00
|
|
|
hasError: false,
|
2019-11-23 05:55:26 +08:00
|
|
|
disableActions: true,
|
2018-03-08 21:38:18 +08:00
|
|
|
});
|
|
|
|
|
2020-03-03 21:59:01 +08:00
|
|
|
joinMicrophone().then(() => {
|
2019-11-23 05:55:26 +08:00
|
|
|
this.setState({
|
|
|
|
disableActions: false,
|
|
|
|
});
|
|
|
|
}).catch(this.handleGoToAudioOptions);
|
2017-10-12 22:49:50 +08:00
|
|
|
}
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
setContent(content) {
|
|
|
|
this.setState(content);
|
|
|
|
}
|
|
|
|
|
2018-03-20 20:09:45 +08:00
|
|
|
skipAudioOptions() {
|
|
|
|
const {
|
|
|
|
isConnecting,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
content,
|
|
|
|
hasError,
|
|
|
|
} = this.state;
|
|
|
|
|
2021-02-23 02:09:14 +08:00
|
|
|
return isConnecting && !content && !hasError;
|
2018-03-20 20:09:45 +08:00
|
|
|
}
|
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
renderAudioOptions() {
|
|
|
|
const {
|
|
|
|
intl,
|
2018-03-02 20:01:34 +08:00
|
|
|
listenOnlyMode,
|
2018-03-06 04:00:52 +08:00
|
|
|
forceListenOnlyAttendee,
|
2021-02-23 02:09:14 +08:00
|
|
|
joinFullAudioImmediately,
|
2018-07-10 03:23:16 +08:00
|
|
|
audioLocked,
|
2019-02-01 01:17:03 +08:00
|
|
|
isMobileNative,
|
2019-04-17 01:04:23 +08:00
|
|
|
formattedDialNum,
|
2019-08-27 04:47:54 +08:00
|
|
|
isRTL,
|
2017-09-26 04:28:36 +08:00
|
|
|
} = this.props;
|
2016-11-16 05:00:28 +08:00
|
|
|
|
2019-01-24 00:06:14 +08:00
|
|
|
const showMicrophone = forceListenOnlyAttendee || audioLocked;
|
|
|
|
|
2019-09-10 22:20:37 +08:00
|
|
|
const arrow = isRTL ? '←' : '→';
|
2019-08-29 22:26:51 +08:00
|
|
|
const dialAudioLabel = `${intl.formatMessage(intlMessages.audioDialTitle)} ${arrow}`;
|
2019-08-27 04:47:54 +08:00
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
return (
|
2019-03-29 05:53:42 +08:00
|
|
|
<div>
|
2022-02-09 23:52:42 +08:00
|
|
|
<Styled.AudioOptions data-test="audioModalOptions">
|
2019-03-29 05:53:42 +08:00
|
|
|
{!showMicrophone && !isMobileNative
|
2021-08-11 11:23:39 +08:00
|
|
|
&& (
|
|
|
|
<>
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.AudioModalButton
|
2021-08-11 11:23:39 +08:00
|
|
|
label={intl.formatMessage(intlMessages.microphoneLabel)}
|
2022-01-20 21:03:18 +08:00
|
|
|
data-test="microphoneBtn"
|
2021-08-11 11:23:39 +08:00
|
|
|
aria-describedby="mic-description"
|
|
|
|
icon="unmute"
|
|
|
|
circle
|
|
|
|
size="jumbo"
|
|
|
|
disabled={audioLocked}
|
|
|
|
onClick={
|
|
|
|
joinFullAudioImmediately
|
|
|
|
? this.handleJoinMicrophone
|
|
|
|
: this.handleGoToEchoTest
|
|
|
|
}
|
|
|
|
/>
|
2021-08-11 12:10:41 +08:00
|
|
|
<span className="sr-only" id="mic-description">
|
2021-08-11 11:23:39 +08:00
|
|
|
{intl.formatMessage(intlMessages.microphoneDesc)}
|
|
|
|
</span>
|
|
|
|
</>
|
|
|
|
)}
|
2019-03-29 05:53:42 +08:00
|
|
|
{listenOnlyMode
|
2021-08-11 11:23:39 +08:00
|
|
|
&& (
|
|
|
|
<>
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.AudioModalButton
|
2021-08-11 11:23:39 +08:00
|
|
|
label={intl.formatMessage(intlMessages.listenOnlyLabel)}
|
2022-01-20 21:03:18 +08:00
|
|
|
data-test="listenOnlyBtn"
|
2021-08-11 11:23:39 +08:00
|
|
|
aria-describedby="listenOnly-description"
|
|
|
|
icon="listen"
|
|
|
|
circle
|
|
|
|
size="jumbo"
|
|
|
|
onClick={this.handleJoinListenOnly}
|
|
|
|
/>
|
2021-08-11 12:10:41 +08:00
|
|
|
<span className="sr-only" id="listenOnly-description">
|
2021-08-11 11:23:39 +08:00
|
|
|
{intl.formatMessage(intlMessages.listenOnlyDesc)}
|
|
|
|
</span>
|
|
|
|
</>
|
|
|
|
)}
|
2021-11-09 21:22:59 +08:00
|
|
|
</Styled.AudioOptions>
|
2019-04-17 01:04:23 +08:00
|
|
|
{formattedDialNum ? (
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.AudioDial
|
2019-08-27 04:47:54 +08:00
|
|
|
label={dialAudioLabel}
|
2019-04-11 04:51:06 +08:00
|
|
|
size="md"
|
|
|
|
color="primary"
|
|
|
|
onClick={() => {
|
|
|
|
this.setState({
|
|
|
|
content: 'audioDial',
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
ghost
|
|
|
|
/>
|
2019-08-29 22:26:51 +08:00
|
|
|
) : null}
|
2019-03-29 05:53:42 +08:00
|
|
|
</div>
|
2017-09-26 04:28:36 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-10-05 04:49:11 +08:00
|
|
|
renderContent() {
|
|
|
|
const {
|
|
|
|
isEchoTest,
|
2017-10-11 02:03:29 +08:00
|
|
|
intl,
|
2017-10-05 04:49:11 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2018-03-20 20:09:45 +08:00
|
|
|
const { content } = this.state;
|
2021-11-09 21:22:59 +08:00
|
|
|
const { animations } = Settings.application;
|
2017-09-26 04:28:36 +08:00
|
|
|
|
2018-03-20 20:09:45 +08:00
|
|
|
if (this.skipAudioOptions()) {
|
2017-10-05 04:49:11 +08:00
|
|
|
return (
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.Connecting role="alert">
|
2021-02-26 23:52:17 +08:00
|
|
|
<span data-test={!isEchoTest ? 'connecting' : 'connectingToEchoTest'}>
|
2021-08-28 00:32:19 +08:00
|
|
|
{intl.formatMessage(intlMessages.connecting)}
|
2018-09-01 00:58:47 +08:00
|
|
|
</span>
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.ConnectingAnimation animations={animations} />
|
|
|
|
</Styled.Connecting>
|
2017-10-11 02:03:29 +08:00
|
|
|
);
|
2017-10-05 04:49:11 +08:00
|
|
|
}
|
2017-10-11 02:03:29 +08:00
|
|
|
return content ? this.contents[content].component() : this.renderAudioOptions();
|
2017-10-05 04:49:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
renderEchoTest() {
|
2016-11-16 05:00:28 +08:00
|
|
|
return (
|
2017-10-05 04:49:11 +08:00
|
|
|
<EchoTest
|
|
|
|
handleNo={this.handleGoToAudioSettings}
|
2017-10-11 02:03:29 +08:00
|
|
|
handleYes={this.handleJoinMicrophone}
|
|
|
|
/>
|
2016-11-16 05:00:28 +08:00
|
|
|
);
|
|
|
|
}
|
2017-10-05 04:49:11 +08:00
|
|
|
|
2017-10-11 02:03:29 +08:00
|
|
|
renderAudioSettings() {
|
2017-10-05 04:49:11 +08:00
|
|
|
const {
|
|
|
|
isConnecting,
|
|
|
|
isConnected,
|
|
|
|
isEchoTest,
|
2017-10-11 02:03:29 +08:00
|
|
|
inputDeviceId,
|
|
|
|
outputDeviceId,
|
2019-01-18 00:33:43 +08:00
|
|
|
joinEchoTest,
|
|
|
|
changeInputDevice,
|
|
|
|
changeOutputDevice,
|
2022-04-12 04:18:43 +08:00
|
|
|
localEchoEnabled,
|
2022-04-05 05:09:35 +08:00
|
|
|
showVolumeMeter,
|
2017-10-05 04:49:11 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2022-04-12 04:18:43 +08:00
|
|
|
const confirmationCallback = !localEchoEnabled
|
2022-04-05 05:09:35 +08:00
|
|
|
? this.handleRetryGoToEchoTest
|
|
|
|
: this.handleJoinSimplifiedEcho;
|
|
|
|
|
|
|
|
const handleGUMFailure = () => {
|
|
|
|
this.setState({
|
|
|
|
content: 'help',
|
|
|
|
errCode: 0,
|
|
|
|
disableActions: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-05 04:49:11 +08:00
|
|
|
return (
|
|
|
|
<AudioSettings
|
|
|
|
handleBack={this.handleGoToAudioOptions}
|
2022-04-05 05:09:35 +08:00
|
|
|
handleConfirmation={confirmationCallback}
|
|
|
|
handleGUMFailure={handleGUMFailure}
|
2019-01-18 00:33:43 +08:00
|
|
|
joinEchoTest={joinEchoTest}
|
|
|
|
changeInputDevice={changeInputDevice}
|
|
|
|
changeOutputDevice={changeOutputDevice}
|
2017-10-05 04:49:11 +08:00
|
|
|
isConnecting={isConnecting}
|
|
|
|
isConnected={isConnected}
|
|
|
|
isEchoTest={isEchoTest}
|
|
|
|
inputDeviceId={inputDeviceId}
|
2017-10-11 02:03:29 +08:00
|
|
|
outputDeviceId={outputDeviceId}
|
2022-04-05 05:09:35 +08:00
|
|
|
withVolumeMeter={showVolumeMeter}
|
2022-04-12 04:18:43 +08:00
|
|
|
withEcho={localEchoEnabled}
|
2017-10-05 04:49:11 +08:00
|
|
|
/>
|
2017-10-11 02:03:29 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-11-17 19:52:48 +08:00
|
|
|
renderHelp() {
|
2019-09-27 21:52:29 +08:00
|
|
|
const { errCode } = this.state;
|
2019-09-30 22:54:34 +08:00
|
|
|
const { AudioError } = this.props;
|
|
|
|
|
|
|
|
const audioErr = {
|
|
|
|
...AudioError,
|
|
|
|
code: errCode,
|
|
|
|
};
|
2019-09-27 21:52:29 +08:00
|
|
|
|
2017-11-17 19:52:48 +08:00
|
|
|
return (
|
|
|
|
<Help
|
|
|
|
handleBack={this.handleGoToAudioOptions}
|
2019-09-30 22:54:34 +08:00
|
|
|
audioErr={audioErr}
|
2017-11-17 19:52:48 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-04-11 04:51:06 +08:00
|
|
|
renderAudioDial() {
|
2019-04-17 01:04:23 +08:00
|
|
|
const { formattedDialNum, formattedTelVoice } = this.props;
|
2019-04-11 04:51:06 +08:00
|
|
|
return (
|
|
|
|
<AudioDial
|
2019-04-16 00:39:36 +08:00
|
|
|
formattedDialNum={formattedDialNum}
|
2019-04-17 01:04:23 +08:00
|
|
|
telVoice={formattedTelVoice}
|
2019-04-11 04:51:06 +08:00
|
|
|
handleBack={this.handleGoToAudioOptions}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-03 05:32:42 +08:00
|
|
|
renderAutoplayOverlay() {
|
|
|
|
const { handleAllowAutoplay } = this.props;
|
|
|
|
return (
|
|
|
|
<AudioAutoplayPrompt
|
|
|
|
handleAllowAutoplay={handleAllowAutoplay}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-10-11 02:03:29 +08:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
2017-11-09 02:41:15 +08:00
|
|
|
showPermissionsOvelay,
|
2019-01-18 00:33:43 +08:00
|
|
|
closeModal,
|
2021-04-03 02:11:46 +08:00
|
|
|
isIE,
|
2017-10-11 02:03:29 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2018-03-20 20:09:45 +08:00
|
|
|
const { content } = this.state;
|
2017-10-11 02:03:29 +08:00
|
|
|
|
|
|
|
return (
|
2017-11-09 02:41:15 +08:00
|
|
|
<span>
|
2019-06-05 01:43:58 +08:00
|
|
|
{showPermissionsOvelay ? <PermissionsOverlay closeModal={closeModal} /> : null}
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.AudioModal
|
2019-01-18 00:33:43 +08:00
|
|
|
onRequestClose={closeModal}
|
2018-12-03 14:01:19 +08:00
|
|
|
hideBorder
|
2022-01-20 21:03:18 +08:00
|
|
|
data-test="audioModal"
|
2019-05-08 21:16:00 +08:00
|
|
|
contentLabel={intl.formatMessage(intlMessages.ariaModalTitle)}
|
2017-11-04 15:38:44 +08:00
|
|
|
>
|
2021-04-03 02:11:46 +08:00
|
|
|
{isIE ? (
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.BrowserWarning>
|
2019-05-07 22:29:47 +08:00
|
|
|
<FormattedMessage
|
|
|
|
id="app.audioModal.unsupportedBrowserLabel"
|
|
|
|
description="Warning when someone joins with a browser that isnt supported"
|
|
|
|
values={{
|
|
|
|
0: <a href="https://www.google.com/chrome/">Chrome</a>,
|
|
|
|
1: <a href="https://getfirefox.com">Firefox</a>,
|
|
|
|
}}
|
|
|
|
/>
|
2021-11-09 21:22:59 +08:00
|
|
|
</Styled.BrowserWarning>
|
2019-05-07 22:29:47 +08:00
|
|
|
) : null}
|
2021-08-09 22:24:02 +08:00
|
|
|
{
|
|
|
|
!this.skipAudioOptions()
|
|
|
|
? (
|
2022-02-09 23:52:42 +08:00
|
|
|
<Styled.Header>
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.Title>
|
2021-10-23 05:14:12 +08:00
|
|
|
{content
|
|
|
|
? intl.formatMessage(this.contents[content].title)
|
|
|
|
: intl.formatMessage(intlMessages.audioChoiceLabel)}
|
2021-11-09 21:22:59 +08:00
|
|
|
</Styled.Title>
|
|
|
|
</Styled.Header>
|
2021-08-09 22:24:02 +08:00
|
|
|
)
|
|
|
|
: null
|
2017-11-09 02:41:15 +08:00
|
|
|
}
|
2021-11-09 21:22:59 +08:00
|
|
|
<Styled.Content>
|
2018-05-25 03:39:17 +08:00
|
|
|
{this.renderContent()}
|
2021-11-09 21:22:59 +08:00
|
|
|
</Styled.Content>
|
|
|
|
</Styled.AudioModal>
|
2017-11-09 02:41:15 +08:00
|
|
|
</span>
|
2017-10-11 02:03:29 +08:00
|
|
|
);
|
2017-10-05 04:49:11 +08:00
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-09-26 04:28:36 +08:00
|
|
|
|
2017-10-11 02:03:29 +08:00
|
|
|
AudioModal.propTypes = propTypes;
|
2017-10-23 20:41:09 +08:00
|
|
|
AudioModal.defaultProps = defaultProps;
|
2017-10-11 02:03:29 +08:00
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
export default injectIntl(AudioModal);
|