Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(e2ee): adds sounds for e2ee enabling/disabling

tmoldovan8x8b1d7debfb9f6
diff --git a/react/features/e2ee/constants.js b/react/features/e2ee/constants.js
new file mode 100644
index 0000000000..ad7ae39ca4
--- /dev/null
+++ b/react/features/e2ee/constants.js
@@ -0,0 +1,15 @@
+// @flow
+
+/**
+ * The identifier of the sound to be played when e2ee is disabled.
+ *
+ * @type {string}
+ */
+export const E2EE_OFF_SOUND_ID = 'E2EE_OFF_SOUND';
+
+/**
+ * The identifier of the sound to be played when e2ee is enabled.
+ *
+ * @type {string}
+ */
+export const E2EE_ON_SOUND_ID = 'E2EE_ON_SOUND';
diff --git a/react/features/e2ee/middleware.js b/react/features/e2ee/middleware.js
index 7713a96d50..e0301dd5cf 100644
--- a/react/features/e2ee/middleware.js
+++ b/react/features/e2ee/middleware.js
@@ -1,12 +1,16 @@
// @flow
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
import { getCurrentConference } from '../base/conference';
import { getLocalParticipant, participantUpdated } from '../base/participants';
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
+import { playSound, registerSound, unregisterSound } from '../base/sounds';
import { TOGGLE_E2EE } from './actionTypes';
import { toggleE2EE } from './actions';
+import { E2EE_OFF_SOUND_ID, E2EE_ON_SOUND_ID } from './constants';
import logger from './logger';
+import { E2EE_OFF_SOUND_FILE, E2EE_ON_SOUND_FILE } from './sounds';
/**
* Middleware that captures actions related to E2EE.
@@ -16,6 +20,21 @@ import logger from './logger';
*/
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
switch (action.type) {
+ case APP_WILL_MOUNT:
+ dispatch(registerSound(
+ E2EE_OFF_SOUND_ID,
+ E2EE_OFF_SOUND_FILE));
+
+ dispatch(registerSound(
+ E2EE_ON_SOUND_ID,
+ E2EE_ON_SOUND_FILE));
+ break;
+
+ case APP_WILL_UNMOUNT:
+ dispatch(unregisterSound(E2EE_OFF_SOUND_ID));
+ dispatch(unregisterSound(E2EE_ON_SOUND_ID));
+ break;
+
case TOGGLE_E2EE: {
const conference = getCurrentConference(getState);
@@ -31,6 +50,10 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
id: participant.id,
local: true
}));
+
+ const soundID = action.enabled ? E2EE_ON_SOUND_ID : E2EE_OFF_SOUND_ID;
+
+ dispatch(playSound(soundID));
}
break;
diff --git a/react/features/e2ee/sounds.js b/react/features/e2ee/sounds.js
new file mode 100644
index 0000000000..e349d62d46
--- /dev/null
+++ b/react/features/e2ee/sounds.js
@@ -0,0 +1,15 @@
+// @flow
+
+/**
+ * The name of the bundled audio file which will be played when e2ee is disabled.
+ *
+ * @type {string}
+ */
+export const E2EE_OFF_SOUND_FILE = 'e2eeOff.mp3';
+
+/**
+ * The name of the bundled audio file which will be played when e2ee is enabled.
+ *
+ * @type {string}
+ */
+export const E2EE_ON_SOUND_FILE = 'e2eeOn.mp3';
diff --git a/sounds/e2eeOff.mp3 b/sounds/e2eeOff.mp3
new file mode 100644
index 0000000000..8c22f38f91
Binary files /dev/null and b/sounds/e2eeOff.mp3 differ
diff --git a/sounds/e2eeOn.mp3 b/sounds/e2eeOn.mp3
new file mode 100644
index 0000000000..48b810e34f
Binary files /dev/null and b/sounds/e2eeOn.mp3 differ