From 7f1eb83dbd5c6d324bde2134dd103bcf11e35573 Mon Sep 17 00:00:00 2001 From: Horatiu Muresan Date: Wed, 1 Apr 2020 18:32:13 +0300 Subject: [PATCH] feat(notifications): Manage audio notifications --- config.js | 3 +++ react/features/base/config/configWhitelist.js | 4 +++- .../features/base/config/extraConfigWhitelist.js | 4 ++++ react/features/recording/middleware.js | 15 ++++++++++++--- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 react/features/base/config/extraConfigWhitelist.js diff --git a/config.js b/config.js index 57cf31d25..326e4ac99 100644 --- a/config.js +++ b/config.js @@ -390,6 +390,9 @@ var config = { // userRegion: "asia" }, + // Decides whether the start/stop recording audio notifications should play on record. + // disableRecordAudioNotification: false, + // Information for the chrome extension banner // chromeExtensionBanner: { // // The chrome extension to be installed address diff --git a/react/features/base/config/configWhitelist.js b/react/features/base/config/configWhitelist.js index 845883d5d..757049932 100644 --- a/react/features/base/config/configWhitelist.js +++ b/react/features/base/config/configWhitelist.js @@ -1,3 +1,5 @@ +import extraConfigWhitelist from './extraConfigWhitelist'; + /** * The config keys to whitelist, the keys that can be overridden. * Currently we can only whitelist the first part of the properties, like @@ -145,4 +147,4 @@ export default [ 'useStunTurn', 'webrtcIceTcpDisable', 'webrtcIceUdpDisable' -]; +].concat(extraConfigWhitelist); diff --git a/react/features/base/config/extraConfigWhitelist.js b/react/features/base/config/extraConfigWhitelist.js new file mode 100644 index 000000000..d66fc0ae3 --- /dev/null +++ b/react/features/base/config/extraConfigWhitelist.js @@ -0,0 +1,4 @@ +/** + * Deploy-specific configuration whitelists + */ +export default []; diff --git a/react/features/recording/middleware.js b/react/features/recording/middleware.js index dbdc1a253..2ab53300e 100644 --- a/react/features/recording/middleware.js +++ b/react/features/recording/middleware.js @@ -130,7 +130,8 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { // but we want to indicate those in case of sip gateway const { iAmRecorder, - iAmSipGateway + iAmSipGateway, + disableRecordAudioNotification } = getState()['features/base/config']; if (iAmRecorder && !iAmSipGateway) { @@ -153,6 +154,11 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { const initiatorName = initiator && getParticipantDisplayName(getState, initiator.getId()); initiatorName && dispatch(showStartedRecordingNotification(mode, initiatorName)); + sendAnalytics(createRecordingEvent('start', mode)); + + if (disableRecordAudioNotification) { + break; + } let soundID; @@ -163,7 +169,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { } if (soundID) { - sendAnalytics(createRecordingEvent('start', mode)); dispatch(playSound(soundID)); } } else if (updatedSessionData.status === OFF @@ -176,6 +181,11 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { duration = (Date.now() / 1000) - oldSessionData.timestamp; } + sendAnalytics(createRecordingEvent('stop', mode, duration)); + + if (disableRecordAudioNotification) { + break; + } if (mode === JitsiRecordingConstants.mode.FILE) { soundOff = RECORDING_OFF_SOUND_ID; @@ -186,7 +196,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { } if (soundOff && soundOn) { - sendAnalytics(createRecordingEvent('stop', mode, duration)); dispatch(stopSound(soundOn)); dispatch(playSound(soundOff)); }