325887e325
This is a rework of the audio join procedure whithout the explict listen only separation in mind. It's supposed to be used in conjunction with the transparent listen only feature so that the distinction between modes is seamless with minimal server-side impact. An abridged list of changes: - Let the user pick no input device when joining microphone while allowing them to set an input device on the fly later on - Give the user the option to join audio with no input device whenever we fail to obtain input devices, with the option to try re-enabling them on the fly later on - Add the option to open the audio settings modal (echo test et al) via the in-call device selection chevron - Rework the SFU audio bridge and its services to support adding/removing tracks on the fly without renegotiation - Rework the SFU audio bridge and its services to support a new peer role called "passive-sendrecv". That role is used by dupled peers that have no active input source on start, but might have one later on. - Remove stale PermissionsOverlay component from the audio modal - Rework how permission errors are detected using the Permissions API - Rework the local echo test so that it uses a separate media tag rather than the remote - Add new, separate dialplans that mute/hold FreeSWITCH channels on hold based on UA strings. This is orchestrated server-side via webrtc-sfu and akka-apps. The basic difference here is that channels now join in their desired state rather than waiting for client side observers to sync the state up. It also mitigates transparent listen only performance edge cases on multiple audio channels joining at the same time. The old, decoupled listen only mode is still present in code while we validate this new approach. To test this, transparentListenOnly must be enabled and listen only mode must be disable on audio join so that the user skips straight through microphone join.
100 lines
2.9 KiB
JavaScript
100 lines
2.9 KiB
JavaScript
import Service from '../service';
|
|
import Storage from '/imports/ui/services/storage/session';
|
|
|
|
const CLIENT_DID_USER_SELECTED_MICROPHONE_KEY = 'clientUserSelectedMicrophone';
|
|
const CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY = 'clientUserSelectedListenOnly';
|
|
|
|
export const setUserSelectedMicrophone = (value) => (
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY, !!value)
|
|
);
|
|
|
|
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)
|
|
);
|
|
|
|
export const joinMicrophone = (options = {}) => {
|
|
const { skipEchoTest = false } = options;
|
|
const shouldSkipEcho = skipEchoTest && Service.inputDeviceId() !== 'listen-only';
|
|
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY, true);
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY, false);
|
|
|
|
const {
|
|
enabled: LOCAL_ECHO_TEST_ENABLED,
|
|
} = window.meetingClientSettings.public.media.localEchoTest;
|
|
|
|
const call = new Promise((resolve, reject) => {
|
|
try {
|
|
if ((shouldSkipEcho && !Service.isConnected()) || LOCAL_ECHO_TEST_ENABLED) {
|
|
return resolve(Service.joinMicrophone(options));
|
|
}
|
|
|
|
return resolve(Service.transferCall());
|
|
} catch {
|
|
return reject(Service.exitAudio);
|
|
}
|
|
});
|
|
|
|
return call.then(() => {
|
|
document.dispatchEvent(new Event("CLOSE_MODAL_AUDIO"));
|
|
}).catch((error) => {
|
|
throw error;
|
|
});
|
|
};
|
|
|
|
export const joinListenOnly = () => {
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_MICROPHONE_KEY, false);
|
|
Storage.setItem(CLIENT_DID_USER_SELECTED_LISTEN_ONLY_KEY, true);
|
|
|
|
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) => {
|
|
throw error;
|
|
});
|
|
};
|
|
|
|
export const leaveEchoTest = () => {
|
|
if (!Service.isEchoTest()) {
|
|
return Promise.resolve();
|
|
}
|
|
return Service.exitAudio();
|
|
};
|
|
|
|
export const closeModal = (callback) => {
|
|
if (Service.isConnecting()) {
|
|
Service.forceExitAudio();
|
|
}
|
|
callback();
|
|
};
|
|
|
|
const getTroubleshootingLink = (errorCode) => {
|
|
const TROUBLESHOOTING_LINKS = window.meetingClientSettings.public.media.audioTroubleshootingLinks;
|
|
|
|
if (TROUBLESHOOTING_LINKS) return TROUBLESHOOTING_LINKS[errorCode] || TROUBLESHOOTING_LINKS[0];
|
|
return null;
|
|
};
|
|
|
|
export default {
|
|
joinMicrophone,
|
|
closeModal,
|
|
joinListenOnly,
|
|
leaveEchoTest,
|
|
didUserSelectedMicrophone,
|
|
didUserSelectedListenOnly,
|
|
getTroubleshootingLink,
|
|
};
|