Skip to content

Commit

Permalink
feat(notifications): Manage audio notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
horymury authored and saghul committed Apr 1, 2020
1 parent 6e4c1f6 commit 7f1eb83
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion react/features/base/config/configWhitelist.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -145,4 +147,4 @@ export default [
'useStunTurn',
'webrtcIceTcpDisable',
'webrtcIceUdpDisable'
];
].concat(extraConfigWhitelist);
4 changes: 4 additions & 0 deletions react/features/base/config/extraConfigWhitelist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Deploy-specific configuration whitelists
*/
export default [];
15 changes: 12 additions & 3 deletions react/features/recording/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;

Expand All @@ -163,7 +169,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
}

if (soundID) {
sendAnalytics(createRecordingEvent('start', mode));
dispatch(playSound(soundID));
}
} else if (updatedSessionData.status === OFF
Expand All @@ -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;
Expand All @@ -186,7 +196,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
}

if (soundOff && soundOn) {
sendAnalytics(createRecordingEvent('stop', mode, duration));
dispatch(stopSound(soundOn));
dispatch(playSound(soundOff));
}
Expand Down

0 comments on commit 7f1eb83

Please sign in to comment.