Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(config, reactions) Added config option to disable reaction sounds (#10046)
robertpin31ce7e010d85
diff --git a/config.js b/config.jsindex 910f1f9667..2dffdc14a7 100644--- a/config.js+++ b/config.js@@ -772,6 +772,7 @@ var config = {// - 'PARTICIPANT_JOINED_SOUND'// - 'PARTICIPANT_LEFT_SOUND'// - 'RAISE_HAND_SOUND'+ // - 'REACTION_SOUND'// - 'RECORDING_OFF_SOUND'// - 'RECORDING_ON_SOUND'// - 'TALK_WHILE_MUTED_SOUND'diff --git a/react/features/base/sounds/actions.js b/react/features/base/sounds/actions.jsindex bd9d9071e7..4584bc5757 100644--- a/react/features/base/sounds/actions.js+++ b/react/features/base/sounds/actions.js@@ -70,7 +70,7 @@ export function playSound(soundId: string): Object {return (dispatch: Function, getState: Function) => {const disabledSounds = getDisabledSounds(getState());- if (!disabledSounds.includes(soundId)) {+ if (!disabledSounds.includes(soundId) && !disabledSounds.find(id => soundId.startsWith(id))) {dispatch({type: PLAY_SOUND,soundIddiff --git a/react/features/reactions/constants.js b/react/features/reactions/constants.jsindex 266dbdac91..5f0c3fd19a 100644--- a/react/features/reactions/constants.js+++ b/react/features/reactions/constants.js@@ -14,13 +14,18 @@ import {*/export const ENDPOINT_REACTION_NAME = 'endpoint-reaction';+/**+ * The prefix for all reaction sound IDs. Also the ID used in config to disable reaction sounds.+ */+export const REACTION_SOUND = 'REACTION_SOUND';+/*** The audio ID prefix of the audio element for which the {@link playAudio} action is* triggered when a new laugh reaction is received.** @type { string }*/-export const LAUGH_SOUND_ID = 'LAUGH_SOUND_';+export const LAUGH_SOUND_ID = `${REACTION_SOUND}_LAUGH_`;/*** The audio ID prefix of the audio element for which the {@link playAudio} action is@@ -28,7 +33,7 @@ export const LAUGH_SOUND_ID = 'LAUGH_SOUND_';** @type {string}*/-export const CLAP_SOUND_ID = 'CLAP_SOUND_';+export const CLAP_SOUND_ID = `${REACTION_SOUND}_CLAP_`;/*** The audio ID prefix of the audio element for which the {@link playAudio} action is@@ -36,7 +41,7 @@ export const CLAP_SOUND_ID = 'CLAP_SOUND_';** @type {string}*/-export const LIKE_SOUND_ID = 'LIKE_SOUND_';+export const LIKE_SOUND_ID = `${REACTION_SOUND}_LIKE_`;/*** The audio ID prefix of the audio element for which the {@link playAudio} action is@@ -44,7 +49,7 @@ export const LIKE_SOUND_ID = 'LIKE_SOUND_';** @type {string}*/-export const BOO_SOUND_ID = 'BOO_SOUND_';+export const BOO_SOUND_ID = `${REACTION_SOUND}_BOO_`;/*** The audio ID prefix of the audio element for which the {@link playAudio} action is@@ -52,7 +57,7 @@ export const BOO_SOUND_ID = 'BOO_SOUND_';** @type {string}*/-export const SURPRISE_SOUND_ID = 'SURPRISE_SOUND_';+export const SURPRISE_SOUND_ID = `${REACTION_SOUND}_SURPRISE_`;/*** The audio ID prefix of the audio element for which the {@link playAudio} action is@@ -60,7 +65,7 @@ export const SURPRISE_SOUND_ID = 'SURPRISE_SOUND_';** @type {string}*/-export const SILENCE_SOUND_ID = 'SILENCE_SOUND_';+export const SILENCE_SOUND_ID = `${REACTION_SOUND}_SILENCE_`;/*** The audio ID of the audio element for which the {@link playAudio} action isdiff --git a/react/features/reactions/middleware.js b/react/features/reactions/middleware.jsindex 01eb2b40ba..e34a7036cc 100644--- a/react/features/reactions/middleware.js+++ b/react/features/reactions/middleware.js@@ -7,6 +7,7 @@ import { getParticipantCount } from '../base/participants';import { MiddlewareRegistry } from '../base/redux';import { updateSettings } from '../base/settings';import { playSound, registerSound, unregisterSound } from '../base/sounds';+import { getDisabledSounds } from '../base/sounds/functions.any';import { isVpaasMeeting } from '../jaas/functions';import { NOTIFICATION_TIMEOUT, showNotification } from '../notifications';@@ -25,7 +26,13 @@ import {sendReactions,setReactionQueue} from './actions.any';-import { ENDPOINT_REACTION_NAME, RAISE_HAND_SOUND_ID, REACTIONS, SOUNDS_THRESHOLDS } from './constants';+import {+ ENDPOINT_REACTION_NAME,+ RAISE_HAND_SOUND_ID,+ REACTIONS,+ REACTION_SOUND,+ SOUNDS_THRESHOLDS+} from './constants';import {getReactionMessageFromBuffer,getReactionsSoundsThresholds,@@ -128,10 +135,12 @@ MiddlewareRegistry.register(store => next => action => {const state = getState();const { queue, notificationDisplayed } = state['features/reactions'];const { soundsReactions } = state['features/base/settings'];+ const disabledSounds = getDisabledSounds(state);const reactions = action.reactions;batch(() => {- if (!notificationDisplayed && soundsReactions && displayReactionSoundsNotification) {+ if (!notificationDisplayed && soundsReactions && !disabledSounds.includes(REACTION_SOUND)+ && displayReactionSoundsNotification) {dispatch(displayReactionSoundsNotification());}if (soundsReactions) {