2020-03-03 04:49:15 +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
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
2020-03-03 04:49:15 +08:00
|
|
|
|
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 CLIENT_DID_USER_SELECTED_MICROPHONE_KEY = 'clientUserSelectedMicrophone';
|
|
|
|
const CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY = 'clientUserSelectedListenOnly';
|
2024-04-04 22:47:01 +08:00
|
|
|
const TROUBLESHOOTING_LINKS = Meteor.settings.public.media.audioTroubleshootingLinks;
|
2020-03-03 04:49:15 +08:00
|
|
|
|
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
|
|
|
export const setUserSelectedMicrophone = (value) => (
|
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY, !!value)
|
|
|
|
);
|
2020-03-03 04:49:15 +08:00
|
|
|
|
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
|
|
|
export const setUserSelectedListenOnly = (value) => (
|
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY, !!value)
|
|
|
|
);
|
|
|
|
|
|
|
|
export const didUserSelectedMicrophone = () => (
|
|
|
|
!!Storage.getItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY)
|
|
|
|
);
|
|
|
|
|
|
|
|
export const didUserSelectedListenOnly = () => (
|
|
|
|
!!Storage.getItem(CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY)
|
|
|
|
);
|
2020-03-03 04:49:15 +08:00
|
|
|
|
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
|
|
|
export const joinMicrophone = (skipEchoTest = false) => {
|
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY, true);
|
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY, false);
|
2020-03-03 04:49:15 +08:00
|
|
|
|
|
|
|
const call = new Promise((resolve, reject) => {
|
2021-05-04 06:26:47 +08:00
|
|
|
try {
|
2022-04-12 04:18:43 +08:00
|
|
|
if ((skipEchoTest && !Service.isConnected()) || Service.localEchoEnabled) {
|
2021-05-04 06:26:47 +08:00
|
|
|
return resolve(Service.joinMicrophone());
|
|
|
|
}
|
|
|
|
|
|
|
|
return resolve(Service.transferCall());
|
|
|
|
} catch {
|
|
|
|
return reject(Service.exitAudio);
|
2020-03-03 04:49:15 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return call.then(() => {
|
2023-03-24 23:29:09 +08:00
|
|
|
document.dispatchEvent(new Event("CLOSE_MODAL_AUDIO"));
|
2020-03-03 04:49:15 +08:00
|
|
|
}).catch((error) => {
|
|
|
|
throw error;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const joinListenOnly = () => {
|
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
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY, false);
|
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY, true);
|
|
|
|
|
2024-04-17 01:27:39 +08:00
|
|
|
return Service.joinListenOnly().then(() => {
|
|
|
|
// Autoplay block wasn't triggered. Close the modal. If autoplay was
|
|
|
|
// blocked, that'll be handled in the modal component when then
|
|
|
|
// prop transitions to a state where it was handled OR the user opts
|
|
|
|
// to close the modal.
|
|
|
|
if (!Service.autoplayBlocked()) {
|
|
|
|
document.dispatchEvent(new Event("CLOSE_MODAL_AUDIO"));
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
2020-03-03 04:49:15 +08:00
|
|
|
throw error;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const leaveEchoTest = () => {
|
|
|
|
if (!Service.isEchoTest()) {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
|
|
|
return Service.exitAudio();
|
|
|
|
};
|
|
|
|
|
2023-03-24 23:29:09 +08:00
|
|
|
export const closeModal = (callback) => {
|
2021-12-03 19:45:07 +08:00
|
|
|
if (Service.isConnecting()) {
|
|
|
|
Service.forceExitAudio();
|
|
|
|
}
|
2023-03-24 23:29:09 +08:00
|
|
|
callback();
|
2020-03-03 04:49:15 +08:00
|
|
|
};
|
|
|
|
|
2024-04-04 22:47:01 +08:00
|
|
|
const getTroubleshootingLink = (errorCode) => {
|
|
|
|
if (TROUBLESHOOTING_LINKS) return TROUBLESHOOTING_LINKS[errorCode] || TROUBLESHOOTING_LINKS[0];
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
2020-03-03 04:49:15 +08:00
|
|
|
export default {
|
|
|
|
joinMicrophone,
|
|
|
|
closeModal,
|
|
|
|
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
|
|
|
didUserSelectedMicrophone,
|
|
|
|
didUserSelectedListenOnly,
|
2024-04-04 22:47:01 +08:00
|
|
|
getTroubleshootingLink,
|
2020-03-03 04:49:15 +08:00
|
|
|
};
|