2024-03-27 03:43:05 +08:00
|
|
|
import React, { useEffect, useState } 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';
|
2024-04-23 22:44:33 +08:00
|
|
|
import { useMutation } from '@apollo/client';
|
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';
|
2024-04-04 21:22:26 +08:00
|
|
|
import usePreviousValue from '/imports/ui/hooks/usePreviousValue';
|
2024-04-23 22:44:33 +08:00
|
|
|
import { SET_AWAY } from '/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/user-actions/mutations';
|
2024-05-02 20:24:03 +08:00
|
|
|
import VideoService from '/imports/ui/components/video-provider/video-provider-graphql/service';
|
2024-04-17 06:39:29 +08:00
|
|
|
import AudioCaptionsSelectContainer from '../audio-graphql/audio-captions/captions/component';
|
2024-04-25 04:06:53 +08:00
|
|
|
import useToggleVoice from '/imports/ui/components/audio/audio-graphql/hooks/useToggleVoice';
|
|
|
|
import {
|
|
|
|
muteAway,
|
|
|
|
} from '/imports/ui/components/audio/audio-graphql/audio-controls/input-stream-live-selector/service';
|
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,
|
2024-04-17 01:33:23 +08:00
|
|
|
isListenOnly: 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,
|
|
|
|
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,
|
2022-04-19 04:05:26 +08:00
|
|
|
changeInputStream: PropTypes.func.isRequired,
|
|
|
|
localEchoEnabled: PropTypes.bool.isRequired,
|
|
|
|
showVolumeMeter: PropTypes.bool.isRequired,
|
2022-08-20 01:22:42 +08:00
|
|
|
notify: PropTypes.func.isRequired,
|
2024-03-27 03:43:05 +08:00
|
|
|
isRTL: PropTypes.bool.isRequired,
|
|
|
|
priority: PropTypes.string.isRequired,
|
|
|
|
isOpen: PropTypes.bool.isRequired,
|
|
|
|
setIsOpen: PropTypes.func.isRequired,
|
|
|
|
AudioError: PropTypes.shape({
|
|
|
|
MIC_ERROR: PropTypes.number.isRequired,
|
|
|
|
NO_SSL: PropTypes.number.isRequired,
|
|
|
|
}).isRequired,
|
2024-04-04 22:47:01 +08:00
|
|
|
getTroubleshootingLink: PropTypes.func.isRequired,
|
2024-05-14 21:31:05 +08:00
|
|
|
away: PropTypes.bool,
|
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,
|
2024-05-14 21:31:05 +08:00
|
|
|
away: 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
|
|
|
});
|
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const AudioModal = (props) => {
|
|
|
|
const [content, setContent] = useState(null);
|
|
|
|
const [hasError, setHasError] = useState(false);
|
|
|
|
const [disableActions, setDisableActions] = useState(false);
|
2024-04-17 01:33:23 +08:00
|
|
|
const [errorInfo, setErrorInfo] = useState(null);
|
2024-03-27 03:43:05 +08:00
|
|
|
const [autoplayChecked, setAutoplayChecked] = useState(false);
|
2024-04-23 22:44:33 +08:00
|
|
|
const [setAway] = useMutation(SET_AWAY);
|
2024-04-25 04:06:53 +08:00
|
|
|
const voiceToggle = useToggleVoice();
|
2024-03-27 03:43:05 +08:00
|
|
|
|
|
|
|
const {
|
|
|
|
forceListenOnlyAttendee,
|
|
|
|
joinFullAudioImmediately,
|
|
|
|
listenOnlyMode,
|
|
|
|
audioLocked,
|
|
|
|
isUsingAudio,
|
2024-04-17 01:33:23 +08:00
|
|
|
isListenOnly,
|
2024-03-27 03:43:05 +08:00
|
|
|
autoplayBlocked,
|
|
|
|
closeModal,
|
|
|
|
isEchoTest,
|
|
|
|
exitAudio,
|
|
|
|
resolve,
|
|
|
|
leaveEchoTest,
|
|
|
|
AudioError,
|
|
|
|
joinEchoTest,
|
|
|
|
isConnecting,
|
|
|
|
localEchoEnabled,
|
|
|
|
joinListenOnly,
|
|
|
|
changeInputStream,
|
|
|
|
joinMicrophone,
|
|
|
|
intl,
|
|
|
|
isMobileNative,
|
|
|
|
formattedDialNum,
|
|
|
|
isRTL,
|
|
|
|
isConnected,
|
|
|
|
inputDeviceId,
|
|
|
|
outputDeviceId,
|
|
|
|
changeInputDevice,
|
|
|
|
changeOutputDevice,
|
|
|
|
showVolumeMeter,
|
|
|
|
notify,
|
|
|
|
formattedTelVoice,
|
|
|
|
handleAllowAutoplay,
|
|
|
|
showPermissionsOvelay,
|
|
|
|
isIE,
|
|
|
|
isOpen,
|
|
|
|
priority,
|
|
|
|
setIsOpen,
|
2024-04-04 22:47:01 +08:00
|
|
|
getTroubleshootingLink,
|
2024-05-14 21:31:05 +08:00
|
|
|
away,
|
2024-03-27 03:43:05 +08:00
|
|
|
} = props;
|
|
|
|
|
|
|
|
const prevAutoplayBlocked = usePreviousValue(autoplayBlocked);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (prevAutoplayBlocked && !autoplayBlocked) {
|
|
|
|
setAutoplayChecked(true);
|
2021-04-30 05:03:18 +08:00
|
|
|
}
|
2024-03-27 03:43:05 +08:00
|
|
|
}, [autoplayBlocked]);
|
2020-03-03 04:49:15 +08:00
|
|
|
|
2024-04-17 01:33:23 +08:00
|
|
|
const handleJoinAudioError = (err) => {
|
2024-04-10 02:17:18 +08:00
|
|
|
const { type, errCode, errMessage } = err;
|
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
switch (type) {
|
|
|
|
case 'MEDIA_ERROR':
|
|
|
|
setContent('help');
|
2024-04-17 01:33:23 +08:00
|
|
|
setErrorInfo({
|
|
|
|
errCode,
|
|
|
|
errMessage,
|
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
setDisableActions(false);
|
|
|
|
break;
|
|
|
|
case 'CONNECTION_ERROR':
|
|
|
|
default:
|
2024-04-17 01:33:23 +08:00
|
|
|
setErrorInfo({
|
|
|
|
errCode,
|
|
|
|
errMessage: type,
|
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
setDisableActions(false);
|
|
|
|
break;
|
2017-10-10 04:48:10 +08:00
|
|
|
}
|
2024-04-10 02:17:18 +08:00
|
|
|
};
|
2018-04-24 22:52:37 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const 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
|
2024-03-27 03:43:05 +08:00
|
|
|
setContent('settings');
|
|
|
|
};
|
2022-04-05 05:09:35 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const handleGoToEchoTest = () => {
|
2019-10-01 22:28:06 +08:00
|
|
|
const { MIC_ERROR } = AudioError;
|
|
|
|
const noSSL = !window.location.protocol.includes('https');
|
|
|
|
|
|
|
|
if (noSSL) {
|
2024-03-27 03:43:05 +08:00
|
|
|
setContent('help');
|
2024-04-17 01:33:23 +08:00
|
|
|
setErrorInfo({
|
|
|
|
errCode: MIC_ERROR.NO_SSL,
|
|
|
|
errMessage: 'NoSSL',
|
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
return null;
|
2019-10-01 22:28:06 +08:00
|
|
|
}
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
if (disableActions && isConnecting) return null;
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
if (localEchoEnabled) return handleGoToLocalEcho();
|
2022-04-05 05:09:35 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
setHasError(false);
|
|
|
|
setDisableActions(true);
|
2018-03-06 04:00:52 +08:00
|
|
|
|
2019-01-18 00:33:43 +08:00
|
|
|
return joinEchoTest().then(() => {
|
2024-03-27 03:43:05 +08:00
|
|
|
setContent('echoTest');
|
|
|
|
setDisableActions(true);
|
2018-03-02 20:01:34 +08:00
|
|
|
}).catch((err) => {
|
2024-04-17 01:33:23 +08:00
|
|
|
handleJoinAudioError(err);
|
2017-11-17 19:52:48 +08:00
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
2017-11-17 19:52:48 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const handleGoToAudioOptions = () => {
|
|
|
|
setContent(null);
|
|
|
|
setHasError(true);
|
|
|
|
setDisableActions(false);
|
|
|
|
};
|
2017-11-17 19:52:48 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const handleGoToAudioSettings = () => {
|
|
|
|
leaveEchoTest().then(() => {
|
|
|
|
setContent('settings');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleRetryGoToEchoTest = () => {
|
|
|
|
setHasError(false);
|
|
|
|
setContent(null);
|
2024-04-17 01:33:23 +08:00
|
|
|
setErrorInfo(null);
|
2024-03-27 03:43:05 +08:00
|
|
|
|
|
|
|
return handleGoToEchoTest();
|
|
|
|
};
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2024-04-23 22:44:33 +08:00
|
|
|
const disableAwayMode = () => {
|
2024-05-14 21:31:05 +08:00
|
|
|
if (!away) return;
|
|
|
|
|
2024-04-25 04:06:53 +08:00
|
|
|
muteAway(false, true, voiceToggle);
|
2024-04-23 22:44:33 +08:00
|
|
|
setAway({
|
|
|
|
variables: {
|
|
|
|
away: false,
|
|
|
|
},
|
|
|
|
});
|
2024-04-24 01:56:23 +08:00
|
|
|
VideoService.setTrackEnabled(true);
|
2024-04-23 22:44:33 +08:00
|
|
|
};
|
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const handleJoinListenOnly = () => {
|
2021-08-09 22:24:02 +08:00
|
|
|
if (disableActions && isConnecting) return null;
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
setDisableActions(true);
|
2024-04-17 01:33:23 +08:00
|
|
|
setHasError(false);
|
|
|
|
setErrorInfo(null);
|
2019-11-23 05:55:26 +08:00
|
|
|
|
|
|
|
return joinListenOnly().then(() => {
|
2024-03-27 03:43:05 +08:00
|
|
|
setDisableActions(false);
|
2024-04-23 22:44:33 +08:00
|
|
|
disableAwayMode();
|
2019-11-23 05:55:26 +08:00
|
|
|
}).catch((err) => {
|
2024-04-17 01:33:23 +08:00
|
|
|
handleJoinAudioError(err);
|
2017-10-10 04:48:10 +08:00
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const handleJoinMicrophone = () => {
|
2021-05-18 03:37:46 +08:00
|
|
|
if (disableActions && isConnecting) return;
|
2019-11-23 05:55:26 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
setHasError(false);
|
|
|
|
setDisableActions(true);
|
2024-04-17 01:33:23 +08:00
|
|
|
setErrorInfo(null);
|
2018-03-08 21:38:18 +08:00
|
|
|
|
2020-03-03 21:59:01 +08:00
|
|
|
joinMicrophone().then(() => {
|
2024-03-27 03:43:05 +08:00
|
|
|
setDisableActions(false);
|
2022-03-29 02:50:10 +08:00
|
|
|
}).catch((err) => {
|
2024-04-17 01:33:23 +08:00
|
|
|
handleJoinAudioError(err);
|
2022-03-29 02:50:10 +08:00
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
2022-03-29 02:50:10 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const handleJoinLocalEcho = (inputStream) => {
|
|
|
|
// Reset the modal to a connecting state - this kind of sucks?
|
|
|
|
// prlanzarin Apr 04 2022
|
|
|
|
setContent(null);
|
|
|
|
if (inputStream) changeInputStream(inputStream);
|
|
|
|
handleJoinMicrophone();
|
2024-04-23 22:44:33 +08:00
|
|
|
disableAwayMode();
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const skipAudioOptions = () => (isConnecting || (forceListenOnlyAttendee && !autoplayChecked))
|
|
|
|
&& !content
|
|
|
|
&& !hasError;
|
|
|
|
|
|
|
|
const renderAudioOptions = () => {
|
|
|
|
const hideMicrophone = forceListenOnlyAttendee || audioLocked;
|
2019-01-24 00:06:14 +08:00
|
|
|
|
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">
|
2024-03-27 03:43:05 +08:00
|
|
|
{!hideMicrophone && !isMobileNative && (
|
|
|
|
<>
|
|
|
|
<Styled.AudioModalButton
|
|
|
|
label={intl.formatMessage(intlMessages.microphoneLabel)}
|
|
|
|
data-test="microphoneBtn"
|
|
|
|
aria-describedby="mic-description"
|
|
|
|
icon="unmute"
|
|
|
|
circle
|
|
|
|
size="jumbo"
|
|
|
|
disabled={audioLocked}
|
|
|
|
onClick={
|
|
|
|
joinFullAudioImmediately
|
|
|
|
? handleJoinMicrophone
|
|
|
|
: handleGoToEchoTest
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<span className="sr-only" id="mic-description">
|
|
|
|
{intl.formatMessage(intlMessages.microphoneDesc)}
|
|
|
|
</span>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
{listenOnlyMode && (
|
|
|
|
<>
|
|
|
|
<Styled.AudioModalButton
|
|
|
|
label={intl.formatMessage(intlMessages.listenOnlyLabel)}
|
|
|
|
data-test="listenOnlyBtn"
|
|
|
|
aria-describedby="listenOnly-description"
|
|
|
|
icon="listen"
|
|
|
|
circle
|
|
|
|
size="jumbo"
|
|
|
|
onClick={handleJoinListenOnly}
|
|
|
|
/>
|
|
|
|
<span className="sr-only" id="listenOnly-description">
|
|
|
|
{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"
|
2022-08-05 01:17:45 +08:00
|
|
|
color="secondary"
|
2019-04-11 04:51:06 +08:00
|
|
|
onClick={() => {
|
2024-03-27 03:43:05 +08:00
|
|
|
setContent('audioDial');
|
2019-04-11 04:51:06 +08:00
|
|
|
}}
|
|
|
|
/>
|
2019-08-29 22:26:51 +08:00
|
|
|
) : null}
|
2024-04-17 06:39:29 +08:00
|
|
|
<AudioCaptionsSelectContainer />
|
2019-03-29 05:53:42 +08:00
|
|
|
</div>
|
2017-09-26 04:28:36 +08:00
|
|
|
);
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
2017-09-26 04:28:36 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const renderEchoTest = () => (
|
|
|
|
<EchoTest
|
|
|
|
handleNo={handleGoToAudioSettings}
|
|
|
|
handleYes={handleJoinMicrophone}
|
|
|
|
/>
|
|
|
|
);
|
2017-10-05 04:49:11 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const renderAudioSettings = () => {
|
2022-04-12 04:18:43 +08:00
|
|
|
const confirmationCallback = !localEchoEnabled
|
2024-03-27 03:43:05 +08:00
|
|
|
? handleRetryGoToEchoTest
|
|
|
|
: handleJoinLocalEcho;
|
2022-04-05 05:09:35 +08:00
|
|
|
|
2024-04-04 22:47:01 +08:00
|
|
|
const handleGUMFailure = (error) => {
|
|
|
|
const code = error?.name === 'NotAllowedError'
|
|
|
|
? AudioError.MIC_ERROR.NO_PERMISSION
|
|
|
|
: 0;
|
2024-03-27 03:43:05 +08:00
|
|
|
setContent('help');
|
2024-04-17 01:33:23 +08:00
|
|
|
setErrorInfo({
|
|
|
|
errCode: code,
|
|
|
|
errMessage: error?.name || 'NotAllowedError',
|
|
|
|
});
|
2024-03-27 03:43:05 +08:00
|
|
|
setDisableActions(false);
|
2022-04-19 04:05:26 +08:00
|
|
|
};
|
2022-04-05 05:09:35 +08:00
|
|
|
|
2017-10-05 04:49:11 +08:00
|
|
|
return (
|
|
|
|
<AudioSettings
|
2024-03-27 03:43:05 +08:00
|
|
|
handleBack={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}
|
2022-04-13 05:32:06 +08:00
|
|
|
produceStreams={localEchoEnabled || showVolumeMeter}
|
2022-08-20 01:22:42 +08:00
|
|
|
notify={notify}
|
2017-10-05 04:49:11 +08:00
|
|
|
/>
|
2017-10-11 02:03:29 +08:00
|
|
|
);
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
2019-09-30 22:54:34 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
const renderHelp = () => {
|
2019-09-30 22:54:34 +08:00
|
|
|
const audioErr = {
|
|
|
|
...AudioError,
|
2024-04-17 01:33:23 +08:00
|
|
|
code: errorInfo?.errCode,
|
|
|
|
message: errorInfo?.errMessage,
|
2019-09-30 22:54:34 +08:00
|
|
|
};
|
2019-09-27 21:52:29 +08:00
|
|
|
|
2017-11-17 19:52:48 +08:00
|
|
|
return (
|
|
|
|
<Help
|
2024-03-27 03:43:05 +08:00
|
|
|
handleBack={handleGoToAudioOptions}
|
2019-09-30 22:54:34 +08:00
|
|
|
audioErr={audioErr}
|
2024-04-17 01:33:23 +08:00
|
|
|
isListenOnly={isListenOnly}
|
|
|
|
troubleshootingLink={getTroubleshootingLink(errorInfo?.errCode)}
|
2017-11-17 19:52:48 +08:00
|
|
|
/>
|
|
|
|
);
|
2024-03-27 03:43:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const renderAudioDial = () => (
|
|
|
|
<AudioDial
|
|
|
|
formattedDialNum={formattedDialNum}
|
|
|
|
telVoice={formattedTelVoice}
|
|
|
|
handleBack={handleGoToAudioOptions}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
|
|
|
const renderAutoplayOverlay = () => (
|
|
|
|
<AudioAutoplayPrompt
|
|
|
|
handleAllowAutoplay={handleAllowAutoplay}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
|
|
|
const contents = {
|
|
|
|
echoTest: {
|
|
|
|
title: intlMessages.echoTestTitle,
|
|
|
|
component: renderEchoTest,
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
title: intlMessages.settingsTitle,
|
|
|
|
component: renderAudioSettings,
|
|
|
|
},
|
|
|
|
help: {
|
|
|
|
title: intlMessages.helpTitle,
|
|
|
|
component: renderHelp,
|
|
|
|
},
|
|
|
|
audioDial: {
|
|
|
|
title: intlMessages.audioDialTitle,
|
|
|
|
component: renderAudioDial,
|
|
|
|
},
|
|
|
|
autoplayBlocked: {
|
|
|
|
title: intlMessages.autoplayPromptTitle,
|
|
|
|
component: renderAutoplayOverlay,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const renderContent = () => {
|
|
|
|
const { animations } = Settings.application;
|
2017-11-17 19:52:48 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
if (skipAudioOptions()) {
|
|
|
|
return (
|
|
|
|
<Styled.Connecting role="alert">
|
|
|
|
<span data-test={!isEchoTest ? 'establishingAudioLabel' : 'connectingToEchoTest'}>
|
|
|
|
{intl.formatMessage(intlMessages.connecting)}
|
|
|
|
</span>
|
|
|
|
<Styled.ConnectingAnimation animations={animations} />
|
|
|
|
</Styled.Connecting>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return content ? contents[content].component() : renderAudioOptions();
|
|
|
|
};
|
2019-04-11 04:51:06 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
useEffect(() => {
|
|
|
|
if (!isUsingAudio) {
|
|
|
|
if (forceListenOnlyAttendee || audioLocked) {
|
|
|
|
handleJoinListenOnly();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (joinFullAudioImmediately && !listenOnlyMode) {
|
|
|
|
handleJoinMicrophone();
|
|
|
|
return;
|
|
|
|
}
|
2019-08-03 05:32:42 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
if (!listenOnlyMode) {
|
|
|
|
handleGoToEchoTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, []);
|
2017-10-11 02:03:29 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
useEffect(() => {
|
|
|
|
if (autoplayBlocked) {
|
|
|
|
setContent('autoplayBlocked');
|
|
|
|
} else if (prevAutoplayBlocked) {
|
|
|
|
closeModal();
|
|
|
|
}
|
|
|
|
}, [autoplayBlocked]);
|
2017-10-11 02:03:29 +08:00
|
|
|
|
2024-03-27 03:43:05 +08:00
|
|
|
useEffect(() => () => {
|
|
|
|
if (isEchoTest) {
|
|
|
|
exitAudio();
|
|
|
|
}
|
|
|
|
if (resolve) resolve();
|
|
|
|
Session.set('audioModalIsOpen', false);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
let title = content
|
|
|
|
? intl.formatMessage(contents[content].title)
|
|
|
|
: intl.formatMessage(intlMessages.audioChoiceLabel);
|
|
|
|
title = !skipAudioOptions() ? title : null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{showPermissionsOvelay ? <PermissionsOverlay closeModal={closeModal} /> : null}
|
|
|
|
<Styled.AudioModal
|
|
|
|
modalName="AUDIO"
|
|
|
|
onRequestClose={closeModal}
|
|
|
|
data-test="audioModal"
|
|
|
|
contentLabel={intl.formatMessage(intlMessages.ariaModalTitle)}
|
|
|
|
title={title}
|
|
|
|
{...{
|
|
|
|
setIsOpen,
|
|
|
|
isOpen,
|
|
|
|
priority,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{isIE ? (
|
|
|
|
<Styled.BrowserWarning>
|
|
|
|
<FormattedMessage
|
|
|
|
id="app.audioModal.unsupportedBrowserLabel"
|
|
|
|
description="Warning when someone joins with a browser that isn't supported"
|
|
|
|
values={{
|
|
|
|
0: <a href="https://www.google.com/chrome/">Chrome</a>,
|
|
|
|
1: <a href="https://getfirefox.com">Firefox</a>,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Styled.BrowserWarning>
|
|
|
|
) : null}
|
|
|
|
<Styled.Content>
|
|
|
|
{renderContent()}
|
|
|
|
</Styled.Content>
|
|
|
|
</Styled.AudioModal>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
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);
|