feat(sounds) skip playing back sounds when leaving a conference

When we leave we see all participants leaving too, which triggers the
"recording has ended" sound for example, which is not desirable.
This commit is contained in:
Saúl Ibarra Corretgé
2024-10-28 12:46:51 +01:00
committed by Saúl Ibarra Corretgé
parent ecf72273af
commit c11f5d36ea

View File

@@ -1,4 +1,5 @@
import { IStore } from '../../app/types';
import { getConferenceState } from '../conference/functions';
import { Sounds } from '../config/configType';
import { AudioElement } from '../media/components/AbstractAudio';
@@ -68,7 +69,14 @@ export function _removeAudioElement(soundId: string) {
*/
export function playSound(soundId: string) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const disabledSounds = getDisabledSounds(getState());
const state = getState();
const disabledSounds = getDisabledSounds(state);
const { leaving } = getConferenceState(state);
// Skip playing sounds when leaving, to avoid hearing that recording has stopped and so on.
if (leaving) {
return;
}
if (!disabledSounds.includes(soundId as Sounds) && !disabledSounds.find(id => soundId.startsWith(id))) {
dispatch({