2017-09-20 01:47:57 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2018-11-01 23:03:16 +08:00
|
|
|
import AudioManager from '/imports/ui/services/audio-manager';
|
2019-05-24 00:47:56 +08:00
|
|
|
import lockContextContainer from '/imports/ui/components/lock-viewers/context/container';
|
2021-04-07 03:58:11 +08:00
|
|
|
import { withUsersConsumer } from '/imports/ui/components/components-data/users-context/context';
|
2019-07-26 02:41:24 +08:00
|
|
|
import logger from '/imports/startup/client/logger';
|
2020-06-23 21:38:59 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2021-02-05 02:42:31 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2017-09-20 01:47:57 +08:00
|
|
|
import AudioControls from './component';
|
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
|
|
|
import {
|
|
|
|
setUserSelectedMicrophone,
|
|
|
|
setUserSelectedListenOnly,
|
|
|
|
} from '../audio-modal/service';
|
2022-05-13 21:42:19 +08:00
|
|
|
import { layoutSelect } from '/imports/ui/components/layout/context';
|
2023-07-25 02:56:40 +08:00
|
|
|
import AudioControlsContainerGraphql from '../audio-graphql/audio-controls/component';
|
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
|
|
|
|
2017-09-20 01:47:57 +08:00
|
|
|
import Service from '../service';
|
2021-02-11 21:23:38 +08:00
|
|
|
import AppService from '/imports/ui/components/app/service';
|
2017-09-20 01:47:57 +08:00
|
|
|
|
2020-06-23 21:38:59 +08:00
|
|
|
const ROLE_VIEWER = Meteor.settings.public.user.role_viewer;
|
2021-02-05 02:42:31 +08:00
|
|
|
const APP_CONFIG = Meteor.settings.public.app;
|
2020-06-23 21:38:59 +08:00
|
|
|
|
2021-04-20 22:36:22 +08:00
|
|
|
const AudioControlsContainer = (props) => {
|
2023-07-25 02:56:40 +08:00
|
|
|
const { users, lockSettings, userLocks, children, ...newProps } = props;
|
2022-05-13 21:42:19 +08:00
|
|
|
const isRTL = layoutSelect((i) => i.isRTL);
|
|
|
|
return <AudioControls {...{ ...newProps, isRTL }} />;
|
2021-04-20 22:36:22 +08:00
|
|
|
};
|
2017-09-20 01:47:57 +08:00
|
|
|
|
2021-02-11 21:23:38 +08:00
|
|
|
const handleLeaveAudio = () => {
|
|
|
|
const meetingIsBreakout = AppService.meetingIsBreakout();
|
|
|
|
|
2020-03-03 04:49:15 +08:00
|
|
|
if (!meetingIsBreakout) {
|
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
|
|
|
setUserSelectedMicrophone(false);
|
|
|
|
setUserSelectedListenOnly(false);
|
2020-03-03 04:49:15 +08:00
|
|
|
}
|
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
const skipOnFistJoin = getFromUserSettings(
|
|
|
|
'bbb_skip_check_audio_on_first_join',
|
|
|
|
APP_CONFIG.skipCheckOnJoin
|
|
|
|
);
|
2021-02-05 02:42:31 +08:00
|
|
|
if (skipOnFistJoin && !Storage.getItem('getEchoTest')) {
|
|
|
|
Storage.setItem('getEchoTest', true);
|
|
|
|
}
|
|
|
|
|
2022-02-09 22:43:54 +08:00
|
|
|
Service.forceExitAudio();
|
2023-07-25 02:56:40 +08:00
|
|
|
logger.info(
|
|
|
|
{
|
|
|
|
logCode: 'audiocontrols_leave_audio',
|
|
|
|
extraInfo: { logType: 'user_action' },
|
|
|
|
},
|
|
|
|
'audio connection closed by user'
|
|
|
|
);
|
2019-07-26 02:41:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const {
|
2019-08-22 20:05:06 +08:00
|
|
|
isVoiceUser,
|
2019-07-26 02:41:24 +08:00
|
|
|
isConnected,
|
|
|
|
isListenOnly,
|
|
|
|
isEchoTest,
|
|
|
|
isMuted,
|
|
|
|
isConnecting,
|
|
|
|
isHangingUp,
|
|
|
|
isTalking,
|
|
|
|
toggleMuteMicrophone,
|
|
|
|
joinListenOnly,
|
|
|
|
} = Service;
|
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
withUsersConsumer(
|
2021-08-09 22:24:02 +08:00
|
|
|
lockContextContainer(
|
2023-03-27 23:36:25 +08:00
|
|
|
withTracker(({ userLocks, users }) => {
|
2021-08-09 22:24:02 +08:00
|
|
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
|
|
|
const isViewer = currentUser.role === ROLE_VIEWER;
|
|
|
|
const isPresenter = currentUser.presenter;
|
|
|
|
const { status } = Service.getBreakoutAudioTransferStatus();
|
2020-06-23 21:38:59 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
if (status === AudioManager.BREAKOUT_AUDIO_TRANSFER_STATES.RETURNING) {
|
|
|
|
Service.setBreakoutAudioTransferStatus({
|
|
|
|
status: AudioManager.BREAKOUT_AUDIO_TRANSFER_STATES.DISCONNECTED,
|
|
|
|
});
|
|
|
|
Service.recoverMicState();
|
|
|
|
}
|
2021-02-26 02:36:11 +08:00
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
return {
|
2021-08-09 22:24:02 +08:00
|
|
|
showMute: isConnected() && !isListenOnly() && !isEchoTest() && !userLocks.userMic,
|
|
|
|
muted: isConnected() && !isListenOnly() && isMuted(),
|
|
|
|
inAudio: isConnected() && !isEchoTest(),
|
|
|
|
listenOnly: isConnected() && isListenOnly(),
|
|
|
|
disable: isConnecting() || isHangingUp() || !Meteor.status().connected,
|
|
|
|
talking: isTalking() && !isMuted(),
|
|
|
|
isVoiceUser: isVoiceUser(),
|
|
|
|
handleToggleMuteMicrophone: () => toggleMuteMicrophone(),
|
2023-03-24 23:29:09 +08:00
|
|
|
joinListenOnly,
|
2021-08-09 22:24:02 +08:00
|
|
|
handleLeaveAudio,
|
|
|
|
inputStream: AudioManager.inputStream,
|
|
|
|
isViewer,
|
|
|
|
isPresenter,
|
2023-03-24 23:29:09 +08:00
|
|
|
isConnected,
|
2023-07-25 02:56:40 +08:00
|
|
|
};
|
|
|
|
})(AudioControlsContainer)
|
|
|
|
)
|
2021-08-09 22:24:02 +08:00
|
|
|
);
|
2023-07-25 02:56:40 +08:00
|
|
|
|
|
|
|
export default AudioControlsContainerGraphql;
|