Quellcode durchsuchen

feat(config) Add config for disabled sound id's

- unify naming for sound id values
master
Horatiu Muresan vor 3 Jahren
Ursprung
Commit
9a16733950
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 25
- 0
config.js Datei anzeigen

683
         // userRegion: "asia"
683
         // userRegion: "asia"
684
     },
684
     },
685
 
685
 
686
+    // Array<string> of disabled sounds.
687
+    // Possible values:
688
+    // - 'E2EE_OFF_SOUND'
689
+    // - 'E2EE_ON_SOUND'
690
+    // - 'INCOMING_MSG_SOUND'
691
+    // - 'KNOCKING_PARTICIPANT_SOUND'
692
+    // - 'LIVE_STREAMING_OFF_SOUND'
693
+    // - 'LIVE_STREAMING_ON_SOUND'
694
+    // - 'NO_AUDIO_SIGNAL_SOUND'
695
+    // - 'NOISY_AUDIO_INPUT_SOUND'
696
+    // - 'OUTGOING_CALL_EXPIRED_SOUND'
697
+    // - 'OUTGOING_CALL_REJECTED_SOUND'
698
+    // - 'OUTGOING_CALL_RINGING_SOUND'
699
+    // - 'OUTGOING_CALL_START_SOUND'
700
+    // - 'PARTICIPANT_JOINED_SOUND'
701
+    // - 'PARTICIPANT_LEFT_SOUND'
702
+    // - 'RAISE_HAND_SOUND'
703
+    // - 'RECORDING_OFF_SOUND'
704
+    // - 'RECORDING_ON_SOUND'
705
+    // - 'TALK_WHILE_MUTED_SOUND'
706
+    // disabledSounds: [],
707
+
708
+    // DEPRECATED! Use `disabledSounds` instead.
686
     // Decides whether the start/stop recording audio notifications should play on record.
709
     // Decides whether the start/stop recording audio notifications should play on record.
687
     // disableRecordAudioNotification: false,
710
     // disableRecordAudioNotification: false,
688
 
711
 
712
+    // DEPRECATED! Use `disabledSounds` instead.
689
     // Disables the sounds that play when other participants join or leave the
713
     // Disables the sounds that play when other participants join or leave the
690
     // conference (if set to true, these sounds will not be played).
714
     // conference (if set to true, these sounds will not be played).
691
     // disableJoinLeaveSounds: false,
715
     // disableJoinLeaveSounds: false,
692
 
716
 
717
+    // DEPRECATED! Use `disabledSounds` instead.
693
     // Disables the sounds that play when a chat message is received.
718
     // Disables the sounds that play when a chat message is received.
694
     // disableIncomingMessageSound: false,
719
     // disableIncomingMessageSound: false,
695
 
720
 

+ 1
- 0
react/features/base/config/configWhitelist.js Datei anzeigen

84
     'disableAP',
84
     'disableAP',
85
     'disableAudioLevels',
85
     'disableAudioLevels',
86
     'disableDeepLinking',
86
     'disableDeepLinking',
87
+    'disabledSounds',
87
     'disableFilmstripAutohiding',
88
     'disableFilmstripAutohiding',
88
     'disableInitialGUM',
89
     'disableInitialGUM',
89
     'disableH264',
90
     'disableH264',

+ 29
- 10
react/features/base/config/reducer.js Datei anzeigen

66
             error: undefined,
66
             error: undefined,
67
 
67
 
68
             /**
68
             /**
69
-                * The URL of the location associated with/configured by this
70
-                * configuration.
71
-                *
72
-                * @type URL
73
-                */
69
+            * The URL of the location associated with/configured by this
70
+            * configuration.
71
+            *
72
+            * @type URL
73
+            */
74
             locationURL: action.locationURL
74
             locationURL: action.locationURL
75
         };
75
         };
76
 
76
 
84
         if (state.locationURL === action.locationURL) {
84
         if (state.locationURL === action.locationURL) {
85
             return {
85
             return {
86
                 /**
86
                 /**
87
-                    * The {@link Error} which prevented the loading of the
88
-                    * configuration of the associated {@code locationURL}.
89
-                    *
90
-                    * @type Error
91
-                    */
87
+                * The {@link Error} which prevented the loading of the
88
+                * configuration of the associated {@code locationURL}.
89
+                *
90
+                * @type Error
91
+                */
92
                 error: action.error
92
                 error: action.error
93
             };
93
             };
94
         }
94
         }
206
         };
206
         };
207
     }
207
     }
208
 
208
 
209
+    newValue.disabledSounds = newValue.disabledSounds || [];
210
+
211
+    if (oldValue.disableJoinLeaveSounds) {
212
+        newValue.disabledSounds.unshift('PARTICIPANT_LEFT_SOUND', 'PARTICIPANT_JOINED_SOUND');
213
+    }
214
+
215
+    if (oldValue.disableRecordAudioNotification) {
216
+        newValue.disabledSounds.unshift(
217
+            'RECORDING_ON_SOUND',
218
+            'RECORDING_OFF_SOUND',
219
+            'LIVE_STREAMING_ON_SOUND',
220
+            'LIVE_STREAMING_OFF_SOUND'
221
+        );
222
+    }
223
+
224
+    if (oldValue.disableIncomingMessageSound) {
225
+        newValue.disabledSounds.unshift('INCOMING_MSG_SOUND');
226
+    }
227
+
209
     if (oldValue.stereo || oldValue.opusMaxAverageBitrate) {
228
     if (oldValue.stereo || oldValue.opusMaxAverageBitrate) {
210
         newValue.audioQuality = {
229
         newValue.audioQuality = {
211
             opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate,
230
             opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate,

+ 1
- 6
react/features/base/participants/middleware.js Datei anzeigen

371
  */
371
  */
372
 function _maybePlaySounds({ getState, dispatch }, action) {
372
 function _maybePlaySounds({ getState, dispatch }, action) {
373
     const state = getState();
373
     const state = getState();
374
-    const { startAudioMuted, disableJoinLeaveSounds } = state['features/base/config'];
374
+    const { startAudioMuted } = state['features/base/config'];
375
     const { soundsParticipantJoined: joinSound, soundsParticipantLeft: leftSound } = state['features/base/settings'];
375
     const { soundsParticipantJoined: joinSound, soundsParticipantLeft: leftSound } = state['features/base/settings'];
376
 
376
 
377
-    // If we have join/leave sounds disabled, don't play anything.
378
-    if (disableJoinLeaveSounds) {
379
-        return;
380
-    }
381
-
382
     // We're not playing sounds for local participant
377
     // We're not playing sounds for local participant
383
     // nor when the user is joining past the "startAudioMuted" limit.
378
     // nor when the user is joining past the "startAudioMuted" limit.
384
     // The intention there was to not play user joined notification in big
379
     // The intention there was to not play user joined notification in big

+ 11
- 7
react/features/base/sounds/actions.js Datei anzeigen

11
     UNREGISTER_SOUND
11
     UNREGISTER_SOUND
12
 } from './actionTypes';
12
 } from './actionTypes';
13
 import { getSoundsPath } from './functions';
13
 import { getSoundsPath } from './functions';
14
+import { getDisabledSounds } from './functions.any';
14
 
15
 
15
 /**
16
 /**
16
  * Adds {@link AudioElement} instance to the base/sounds feature state for the
17
  * Adds {@link AudioElement} instance to the base/sounds feature state for the
63
  *
64
  *
64
  * @param {string} soundId - The id of the sound to be played (the same one
65
  * @param {string} soundId - The id of the sound to be played (the same one
65
  * which was used in {@link registerSound} to register the sound).
66
  * which was used in {@link registerSound} to register the sound).
66
- * @returns {{
67
- *     type: PLAY_SOUND,
68
- *     soundId: string
69
- * }}
67
+ * @returns {Function}
70
  */
68
  */
71
 export function playSound(soundId: string): Object {
69
 export function playSound(soundId: string): Object {
72
-    return {
73
-        type: PLAY_SOUND,
74
-        soundId
70
+    return (dispatch: Function, getState: Function) => {
71
+        const disabledSounds = getDisabledSounds(getState());
72
+
73
+        if (!disabledSounds.includes(soundId)) {
74
+            dispatch({
75
+                type: PLAY_SOUND,
76
+                soundId
77
+            });
78
+        }
75
     };
79
     };
76
 }
80
 }
77
 
81
 

+ 11
- 0
react/features/base/sounds/functions.any.js Datei anzeigen

1
+// @flow
2
+
3
+/**
4
+ * Selector for retrieving the disabled sounds array.
5
+ *
6
+ * @param {Object} state - The Redux state.
7
+ * @returns {Array<string>} - The disabled sound id's array.
8
+ */
9
+export function getDisabledSounds(state: Object) {
10
+    return state['features/base/config'].disabledSounds || [];
11
+}

+ 2
- 2
react/features/chat/middleware.js Datei anzeigen

313
     // Logic for all platforms:
313
     // Logic for all platforms:
314
     const state = getState();
314
     const state = getState();
315
     const { isOpen: isChatOpen } = state['features/chat'];
315
     const { isOpen: isChatOpen } = state['features/chat'];
316
-    const { disableIncomingMessageSound, iAmRecorder } = state['features/base/config'];
316
+    const { iAmRecorder } = state['features/base/config'];
317
     const { soundsIncomingMessage: soundEnabled } = state['features/base/settings'];
317
     const { soundsIncomingMessage: soundEnabled } = state['features/base/settings'];
318
 
318
 
319
-    if (!disableIncomingMessageSound && soundEnabled && shouldPlaySound && !isChatOpen) {
319
+    if (soundEnabled && shouldPlaySound && !isChatOpen) {
320
         dispatch(playSound(INCOMING_MSG_SOUND_ID));
320
         dispatch(playSound(INCOMING_MSG_SOUND_ID));
321
     }
321
     }
322
 
322
 

+ 4
- 4
react/features/invite/constants.js Datei anzeigen

17
  * @type {string}
17
  * @type {string}
18
  */
18
  */
19
 export const OUTGOING_CALL_EXPIRED_SOUND_ID
19
 export const OUTGOING_CALL_EXPIRED_SOUND_ID
20
-    = 'OUTGOING_CALL_EXPIRED_SOUND_ID';
20
+    = 'OUTGOING_CALL_EXPIRED_SOUND';
21
 
21
 
22
 /**
22
 /**
23
  * The identifier of the sound to be played when the status of an outgoing call
23
  * The identifier of the sound to be played when the status of an outgoing call
26
  * @type {string}
26
  * @type {string}
27
  */
27
  */
28
 export const OUTGOING_CALL_REJECTED_SOUND_ID
28
 export const OUTGOING_CALL_REJECTED_SOUND_ID
29
-    = 'OUTGOING_CALL_REJECTED_SOUND_ID';
29
+    = 'OUTGOING_CALL_REJECTED_SOUND';
30
 
30
 
31
 /**
31
 /**
32
  * The identifier of the sound to be played when the status of an outgoing call
32
  * The identifier of the sound to be played when the status of an outgoing call
34
  *
34
  *
35
  * @type {string}
35
  * @type {string}
36
  */
36
  */
37
-export const OUTGOING_CALL_RINGING_SOUND_ID = 'OUTGOING_CALL_RINGING_SOUND_ID';
37
+export const OUTGOING_CALL_RINGING_SOUND_ID = 'OUTGOING_CALL_RINGING_SOUND';
38
 
38
 
39
 /**
39
 /**
40
  * The identifier of the sound to be played when outgoing call is started.
40
  * The identifier of the sound to be played when outgoing call is started.
41
  *
41
  *
42
  * @type {string}
42
  * @type {string}
43
  */
43
  */
44
-export const OUTGOING_CALL_START_SOUND_ID = 'OUTGOING_CALL_START_SOUND_ID';
44
+export const OUTGOING_CALL_START_SOUND_ID = 'OUTGOING_CALL_START_SOUND';
45
 
45
 
46
 /**
46
 /**
47
  * Regex for matching sip addresses.
47
  * Regex for matching sip addresses.

+ 1
- 1
react/features/no-audio-signal/constants.js Datei anzeigen

3
  *
3
  *
4
  * @type {string}
4
  * @type {string}
5
  */
5
  */
6
-export const NO_AUDIO_SIGNAL_SOUND_ID = 'NO_AUDIO_SIGNAL_SOUND_ID';
6
+export const NO_AUDIO_SIGNAL_SOUND_ID = 'NO_AUDIO_SIGNAL_SOUND';

+ 1
- 1
react/features/noise-detection/constants.js Datei anzeigen

3
  *
3
  *
4
  * @type {string}
4
  * @type {string}
5
  */
5
  */
6
-export const NOISY_AUDIO_INPUT_SOUND_ID = 'NOISY_AUDIO_INPUT_SOUND_ID';
6
+export const NOISY_AUDIO_INPUT_SOUND_ID = 'NOISY_AUDIO_INPUT_SOUND';

+ 1
- 1
react/features/reactions/constants.js Datei anzeigen

68
  *
68
  *
69
  * @type {string}
69
  * @type {string}
70
  */
70
  */
71
-export const RAISE_HAND_SOUND_ID = 'RAISE_HAND_SOUND_ID';
71
+export const RAISE_HAND_SOUND_ID = 'RAISE_HAND_SOUND';
72
 
72
 
73
 export type ReactionEmojiProps = {
73
 export type ReactionEmojiProps = {
74
 
74
 

+ 0
- 9
react/features/recording/middleware.js Datei anzeigen

135
         const {
135
         const {
136
             iAmRecorder,
136
             iAmRecorder,
137
             iAmSipGateway,
137
             iAmSipGateway,
138
-            disableRecordAudioNotification,
139
             recordingLimit
138
             recordingLimit
140
         } = getState()['features/base/config'];
139
         } = getState()['features/base/config'];
141
 
140
 
165
 
164
 
166
                 sendAnalytics(createRecordingEvent('start', mode));
165
                 sendAnalytics(createRecordingEvent('start', mode));
167
 
166
 
168
-                if (disableRecordAudioNotification) {
169
-                    break;
170
-                }
171
-
172
                 let soundID;
167
                 let soundID;
173
 
168
 
174
                 if (mode === JitsiRecordingConstants.mode.FILE) {
169
                 if (mode === JitsiRecordingConstants.mode.FILE) {
200
                 }
195
                 }
201
                 sendAnalytics(createRecordingEvent('stop', mode, duration));
196
                 sendAnalytics(createRecordingEvent('stop', mode, duration));
202
 
197
 
203
-                if (disableRecordAudioNotification) {
204
-                    break;
205
-                }
206
-
207
                 if (mode === JitsiRecordingConstants.mode.FILE) {
198
                 if (mode === JitsiRecordingConstants.mode.FILE) {
208
                     soundOff = RECORDING_OFF_SOUND_ID;
199
                     soundOff = RECORDING_OFF_SOUND_ID;
209
                     soundOn = RECORDING_ON_SOUND_ID;
200
                     soundOn = RECORDING_ON_SOUND_ID;

+ 1
- 1
react/features/talk-while-muted/constants.js Datei anzeigen

3
  *
3
  *
4
  * @type {string}
4
  * @type {string}
5
  */
5
  */
6
-export const TALK_WHILE_MUTED_SOUND_ID = 'TALK_WHILE_MUTED_SOUND_ID';
6
+export const TALK_WHILE_MUTED_SOUND_ID = 'TALK_WHILE_MUTED_SOUND';

Laden…
Abbrechen
Speichern