2017-09-29 21:38:10 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2021-04-01 19:14:24 +08:00
|
|
|
import browserInfo from '/imports/utils/browserInfo';
|
2018-09-14 02:09:30 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2017-09-29 21:38:10 +08:00
|
|
|
import AudioModal from './component';
|
2021-10-20 04:35:39 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
2019-04-11 04:51:06 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2019-05-24 00:47:56 +08:00
|
|
|
import lockContextContainer from '/imports/ui/components/lock-viewers/context/container';
|
2019-09-30 22:54:34 +08:00
|
|
|
import AudioError from '/imports/ui/services/audio-manager/error-codes';
|
2020-03-03 04:49:15 +08:00
|
|
|
import AppService from '/imports/ui/components/app/service';
|
|
|
|
import {
|
|
|
|
joinMicrophone,
|
|
|
|
closeModal,
|
|
|
|
joinListenOnly,
|
|
|
|
leaveEchoTest,
|
|
|
|
} from './service';
|
2021-02-05 02:42:31 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
2017-09-29 21:38:10 +08:00
|
|
|
import Service from '../service';
|
|
|
|
|
fix: breakout autojoin audio with wrong behavior
When joining/returning breakouts, audio would always connect
with full audio. This can lead to a performance problem, once
all listenonly users would join full audio, increasing the
number of streams in FreeSWITCH.
We now have a consistent behavior, which is:
1 - The choice made by the user in the main room is predominant:
if mic is active in main room, user will automatically
join mic in breakout room. When returning from breakout
room, user will also join with mic again.
2 - Changes made in breakout room won't have effect when
returning to the main room. This means if user, for example,
change from listenonly to mic in breakout room, the returning
will consider the option choosen previously (listenonly) and
listenonly will be active again in the main room.
3 - If user didn't join audio in the main room, the audio modal
will be prompted when joining the breakout room (this is
a special case of (1))
The following is some technicall information:
InputStreamLiveSelector (component.jsx) now calls
'handleLeaveAudio' function, which is the default
function when user leaves audio (also used when
dynamic devices are inactive).
We now store information about user's choice (mic or listenonly)
using local storage, instead of the previous cookie method (this
was triggering some warnings in browser's console).
Also did a small refactoring to match eslint rules.
Fixes #11662.
2021-04-21 01:38:11 +08:00
|
|
|
const AudioModalContainer = (props) => <AudioModal {...props} />;
|
2020-03-03 04:49:15 +08:00
|
|
|
|
2018-03-02 20:01:34 +08:00
|
|
|
const APP_CONFIG = Meteor.settings.public.app;
|
|
|
|
|
2019-09-07 04:28:02 +08:00
|
|
|
const invalidDialNumbers = ['0', '613-555-1212', '613-555-1234', '0000'];
|
|
|
|
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
|
|
|
2023-03-24 23:29:09 +08:00
|
|
|
export default lockContextContainer(withTracker(({ userLocks, setIsOpen }) => {
|
2019-07-22 22:28:13 +08:00
|
|
|
const listenOnlyMode = getFromUserSettings('bbb_listen_only_mode', APP_CONFIG.listenOnlyMode);
|
2019-07-25 01:04:46 +08:00
|
|
|
const forceListenOnly = getFromUserSettings('bbb_force_listen_only', APP_CONFIG.forceListenOnly);
|
2019-07-22 22:28:13 +08:00
|
|
|
const skipCheck = getFromUserSettings('bbb_skip_check_audio', APP_CONFIG.skipCheck);
|
2021-02-05 02:42:31 +08:00
|
|
|
const skipCheckOnJoin = getFromUserSettings('bbb_skip_check_audio_on_first_join', APP_CONFIG.skipCheckOnJoin);
|
|
|
|
const autoJoin = getFromUserSettings('bbb_auto_join_audio', APP_CONFIG.autoJoin);
|
2019-08-30 00:26:07 +08:00
|
|
|
const meeting = Meetings.findOne({ meetingId: Auth.meetingID }, { fields: { voiceProp: 1 } });
|
2021-02-05 02:42:31 +08:00
|
|
|
const getEchoTest = Storage.getItem('getEchoTest');
|
|
|
|
|
2019-04-17 01:04:23 +08:00
|
|
|
let formattedDialNum = '';
|
|
|
|
let formattedTelVoice = '';
|
|
|
|
let combinedDialInNum = '';
|
|
|
|
if (meeting && meeting.voiceProp) {
|
|
|
|
const { dialNumber, telVoice } = meeting.voiceProp;
|
|
|
|
if (invalidDialNumbers.indexOf(dialNumber) < 0) {
|
|
|
|
formattedDialNum = dialNumber;
|
|
|
|
formattedTelVoice = telVoice;
|
|
|
|
combinedDialInNum = `${dialNumber.replace(/\D+/g, '')},,,${telVoice.replace(/\D+/g, '')}`;
|
|
|
|
}
|
|
|
|
}
|
2018-09-14 02:09:30 +08:00
|
|
|
|
2020-03-03 04:49:15 +08:00
|
|
|
const meetingIsBreakout = AppService.meetingIsBreakout();
|
2021-02-11 21:23:38 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
const joinFullAudioImmediately = (
|
|
|
|
autoJoin
|
|
|
|
&& (
|
|
|
|
skipCheck
|
|
|
|
|| (skipCheckOnJoin && !getEchoTest)
|
|
|
|
))
|
|
|
|
|| (
|
|
|
|
skipCheck
|
|
|
|
|| (skipCheckOnJoin && !getEchoTest)
|
|
|
|
);
|
2021-02-05 02:42:31 +08:00
|
|
|
|
|
|
|
const forceListenOnlyAttendee = forceListenOnly && !Service.isUserModerator();
|
2020-03-03 21:59:01 +08:00
|
|
|
|
2021-10-23 05:14:12 +08:00
|
|
|
const { isIe } = browserInfo;
|
2021-04-01 19:14:24 +08:00
|
|
|
|
2018-09-14 02:09:30 +08:00
|
|
|
return ({
|
2020-03-03 04:49:15 +08:00
|
|
|
meetingIsBreakout,
|
2023-03-24 23:29:09 +08:00
|
|
|
closeModal: () => closeModal(() => setIsOpen(false)),
|
fix: breakout autojoin audio with wrong behavior
When joining/returning breakouts, audio would always connect
with full audio. This can lead to a performance problem, once
all listenonly users would join full audio, increasing the
number of streams in FreeSWITCH.
We now have a consistent behavior, which is:
1 - The choice made by the user in the main room is predominant:
if mic is active in main room, user will automatically
join mic in breakout room. When returning from breakout
room, user will also join with mic again.
2 - Changes made in breakout room won't have effect when
returning to the main room. This means if user, for example,
change from listenonly to mic in breakout room, the returning
will consider the option choosen previously (listenonly) and
listenonly will be active again in the main room.
3 - If user didn't join audio in the main room, the audio modal
will be prompted when joining the breakout room (this is
a special case of (1))
The following is some technicall information:
InputStreamLiveSelector (component.jsx) now calls
'handleLeaveAudio' function, which is the default
function when user leaves audio (also used when
dynamic devices are inactive).
We now store information about user's choice (mic or listenonly)
using local storage, instead of the previous cookie method (this
was triggering some warnings in browser's console).
Also did a small refactoring to match eslint rules.
Fixes #11662.
2021-04-21 01:38:11 +08:00
|
|
|
joinMicrophone: (skipEchoTest) => joinMicrophone(skipEchoTest || skipCheck || skipCheckOnJoin),
|
2020-03-03 04:49:15 +08:00
|
|
|
joinListenOnly,
|
|
|
|
leaveEchoTest,
|
fix: breakout autojoin audio with wrong behavior
When joining/returning breakouts, audio would always connect
with full audio. This can lead to a performance problem, once
all listenonly users would join full audio, increasing the
number of streams in FreeSWITCH.
We now have a consistent behavior, which is:
1 - The choice made by the user in the main room is predominant:
if mic is active in main room, user will automatically
join mic in breakout room. When returning from breakout
room, user will also join with mic again.
2 - Changes made in breakout room won't have effect when
returning to the main room. This means if user, for example,
change from listenonly to mic in breakout room, the returning
will consider the option choosen previously (listenonly) and
listenonly will be active again in the main room.
3 - If user didn't join audio in the main room, the audio modal
will be prompted when joining the breakout room (this is
a special case of (1))
The following is some technicall information:
InputStreamLiveSelector (component.jsx) now calls
'handleLeaveAudio' function, which is the default
function when user leaves audio (also used when
dynamic devices are inactive).
We now store information about user's choice (mic or listenonly)
using local storage, instead of the previous cookie method (this
was triggering some warnings in browser's console).
Also did a small refactoring to match eslint rules.
Fixes #11662.
2021-04-21 01:38:11 +08:00
|
|
|
changeInputDevice: (inputDeviceId) => Service
|
|
|
|
.changeInputDevice(inputDeviceId),
|
2022-04-12 06:18:40 +08:00
|
|
|
changeInputStream: (inputStream) => Service.changeInputStream(inputStream),
|
2022-04-05 05:09:35 +08:00
|
|
|
changeOutputDevice: (outputDeviceId, isLive) => Service
|
|
|
|
.changeOutputDevice(outputDeviceId, isLive),
|
2018-01-08 12:44:42 +08:00
|
|
|
joinEchoTest: () => Service.joinEchoTest(),
|
|
|
|
exitAudio: () => Service.exitAudio(),
|
|
|
|
isConnecting: Service.isConnecting(),
|
|
|
|
isConnected: Service.isConnected(),
|
2021-04-30 05:03:18 +08:00
|
|
|
isUsingAudio: Service.isUsingAudio(),
|
2018-01-08 12:44:42 +08:00
|
|
|
isEchoTest: Service.isEchoTest(),
|
|
|
|
inputDeviceId: Service.inputDeviceId(),
|
|
|
|
outputDeviceId: Service.outputDeviceId(),
|
|
|
|
showPermissionsOvelay: Service.isWaitingPermissions(),
|
2022-04-05 05:09:35 +08:00
|
|
|
showVolumeMeter: Service.showVolumeMeter,
|
2022-04-12 04:18:43 +08:00
|
|
|
localEchoEnabled: Service.localEchoEnabled,
|
2018-03-06 04:00:52 +08:00
|
|
|
listenOnlyMode,
|
2019-04-16 00:39:36 +08:00
|
|
|
formattedDialNum,
|
2019-04-17 01:04:23 +08:00
|
|
|
formattedTelVoice,
|
|
|
|
combinedDialInNum,
|
2019-05-24 00:47:56 +08:00
|
|
|
audioLocked: userLocks.userMic,
|
2021-02-05 02:42:31 +08:00
|
|
|
joinFullAudioImmediately,
|
|
|
|
forceListenOnlyAttendee,
|
2019-02-01 01:17:03 +08:00
|
|
|
isMobileNative: navigator.userAgent.toLowerCase().includes('bbbnative'),
|
2021-04-03 02:11:46 +08:00
|
|
|
isIE: isIe,
|
2019-08-03 05:32:42 +08:00
|
|
|
autoplayBlocked: Service.autoplayBlocked(),
|
|
|
|
handleAllowAutoplay: () => Service.handleAllowAutoplay(),
|
2022-08-20 01:22:42 +08:00
|
|
|
notify: Service.notify,
|
2019-08-27 04:47:54 +08:00
|
|
|
isRTL,
|
2019-09-30 22:54:34 +08:00
|
|
|
AudioError,
|
2018-09-14 02:09:30 +08:00
|
|
|
});
|
2023-03-24 23:29:09 +08:00
|
|
|
})(AudioModalContainer));
|