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
feat(recording): add sounds for when recording starts and stops (#3078)
virtuacoplenny3e79926ad42e
diff --git a/android/sdk/build.gradle b/android/sdk/build.gradleindex 21d44ab4f7..b614183617 100644--- a/android/sdk/build.gradle+++ b/android/sdk/build.gradle@@ -78,6 +78,8 @@ gradle.projectsEvaluated {from("${projectDir}/../../sounds/left.wav")from("${projectDir}/../../sounds/outgoingRinging.wav")from("${projectDir}/../../sounds/outgoingStart.wav")+ from("${projectDir}/../../sounds/recordingOn.mp3")+ from("${projectDir}/../../sounds/recordingOff.mp3")from("${projectDir}/../../sounds/rejected.wav")into("${bundlePath}/assets/sounds")}diff --git a/ios/sdk/sdk.xcodeproj/project.pbxproj b/ios/sdk/sdk.xcodeproj/project.pbxprojindex bb7c0d7233..af0f612dd2 100644--- a/ios/sdk/sdk.xcodeproj/project.pbxproj+++ b/ios/sdk/sdk.xcodeproj/project.pbxproj@@ -29,6 +29,8 @@0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */; };0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */; };+ 6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC720C06D490089C899 /* recordingOn.mp3 */; };+ 6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC920C06D530089C899 /* recordingOff.mp3 */; };75635B0A20751D6D00F29C9F /* joined.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0820751D6D00F29C9F /* joined.wav */; };75635B0B20751D6D00F29C9F /* left.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0920751D6D00F29C9F /* left.wav */; };A4414AE020B37F1A003546E6 /* rejected.wav in Resources */ = {isa = PBXBuildFile; fileRef = A4414ADF20B37F1A003546E6 /* rejected.wav */; };@@ -78,6 +80,8 @@0BD906E51EC0C00300C8C18E /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };0BD906E81EC0C00300C8C18E /* JitsiMeet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeet.h; sourceTree = "<group>"; };0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };+ 6C31EDC720C06D490089C899 /* recordingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOn.mp3; path = ../../sounds/recordingOn.mp3; sourceTree = "<group>"; };+ 6C31EDC920C06D530089C899 /* recordingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOff.mp3; path = ../../sounds/recordingOff.mp3; sourceTree = "<group>"; };75635B0820751D6D00F29C9F /* joined.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = joined.wav; path = ../../sounds/joined.wav; sourceTree = "<group>"; };75635B0920751D6D00F29C9F /* left.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = left.wav; path = ../../sounds/left.wav; sourceTree = "<group>"; };98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };@@ -118,6 +122,8 @@0BCA49681EC4BBE500B793EE /* Resources */ = {isa = PBXGroup;children = (+ 6C31EDC720C06D490089C899 /* recordingOn.mp3 */,+ 6C31EDC920C06D530089C899 /* recordingOff.mp3 */,A4414ADF20B37F1A003546E6 /* rejected.wav */,0BC4B8681F8C01E100CE8B21 /* CallKitIcon.png */,C6245F5B2053091D0040BE68 /* [email protected] */,@@ -315,10 +321,12 @@buildActionMask = 2147483647;files = (0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */,+ 6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */,A4414AE020B37F1A003546E6 /* rejected.wav in Resources */,0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */,0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */,C6245F5D2053091D0040BE68 /* [email protected] in Resources */,+ 6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */,0BC4B8691F8C03A700CE8B21 /* CallKitIcon.png in Resources */,75635B0B20751D6D00F29C9F /* left.wav in Resources */,75635B0A20751D6D00F29C9F /* joined.wav in Resources */,diff --git a/react/features/recording/constants.js b/react/features/recording/constants.jsindex 3e76a775f2..a8e98b978c 100644--- a/react/features/recording/constants.js+++ b/react/features/recording/constants.js@@ -1,5 +1,21 @@// @flow+/**+ * The identifier of the sound to be played when a recording or live streaming+ * session is stopped.+ *+ * @type {string}+ */+export const RECORDING_OFF_SOUND_ID = 'RECORDING_OFF_SOUND';++/**+ * The identifier of the sound to be played when a recording or live streaming+ * session is started.+ *+ * @type {string}+ */+export const RECORDING_ON_SOUND_ID = 'RECORDING_ON_SOUND';+/*** Expected supported recording types. JIBRI is known to support live streaming* whereas JIRECON is for recording.diff --git a/react/features/recording/functions.js b/react/features/recording/functions.jsindex ad215a4a96..cd789b5076 100644--- a/react/features/recording/functions.js+++ b/react/features/recording/functions.js@@ -16,3 +16,16 @@ export function getActiveSession(state, mode) {&& (sessionData.status === statusConstants.ON|| sessionData.status === statusConstants.PENDING));}++/**+ * Searches in the passed in redux state for a recording session that matches+ * the passed in recording session ID.+ *+ * @param {Object} state - The redux state to search in.+ * @param {string} id - The ID of the recording session to find.+ * @returns {Object|undefined}+ */+export function getSessionById(state, id) {+ return state['features/recording'].sessionDatas.find(+ sessionData => sessionData.id === id);+}diff --git a/react/features/recording/middleware.js b/react/features/recording/middleware.jsindex 407735ee36..5afc8fb260 100644--- a/react/features/recording/middleware.js+++ b/react/features/recording/middleware.js@@ -1,10 +1,28 @@/* @flow */import { CONFERENCE_WILL_JOIN } from '../base/conference';-import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';+import {+ JitsiConferenceEvents,+ JitsiRecordingConstants+} from '../base/lib-jitsi-meet';import { MiddlewareRegistry } from '../base/redux';+import {+ playSound,+ registerSound,+ stopSound,+ unregisterSound+} from '../base/sounds';++import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';import { updateRecordingSessionData } from './actions';+import { RECORDING_SESSION_UPDATED } from './actionTypes';+import { RECORDING_OFF_SOUND_ID, RECORDING_ON_SOUND_ID } from './constants';+import { getSessionById } from './functions';+import {+ RECORDING_OFF_SOUND_FILE,+ RECORDING_ON_SOUND_FILE+} from './sounds';/*** The redux middleware to handle the recorder updates in a React way.@@ -12,10 +30,34 @@ import { updateRecordingSessionData } from './actions';* @param {Store} store - The redux store.* @returns {Function}*/-MiddlewareRegistry.register(({ dispatch }) => next => action => {+MiddlewareRegistry.register(store => next => action => {+ let oldSessionData;++ if (action.type === RECORDING_SESSION_UPDATED) {+ oldSessionData+ = getSessionById(store.getState(), action.sessionData.id);+ }+const result = next(action);switch (action.type) {+ case APP_WILL_MOUNT:+ store.dispatch(registerSound(+ RECORDING_OFF_SOUND_ID,+ RECORDING_OFF_SOUND_FILE));++ store.dispatch(registerSound(+ RECORDING_ON_SOUND_ID,+ RECORDING_ON_SOUND_FILE));++ break;++ case APP_WILL_UNMOUNT:+ store.dispatch(unregisterSound(RECORDING_OFF_SOUND_ID));+ store.dispatch(unregisterSound(RECORDING_ON_SOUND_ID));++ break;+case CONFERENCE_WILL_JOIN: {const { conference } = action;@@ -24,7 +66,7 @@ MiddlewareRegistry.register(({ dispatch }) => next => action => {recorderSession => {if (recorderSession && recorderSession.getID()) {- dispatch(+ store.dispatch(updateRecordingSessionData(recorderSession));return;@@ -33,6 +75,26 @@ MiddlewareRegistry.register(({ dispatch }) => next => action => {break;}++ case RECORDING_SESSION_UPDATED: {+ const updatedSessionData+ = getSessionById(store.getState(), action.sessionData.id);++ if (updatedSessionData.mode === JitsiRecordingConstants.mode.FILE) {+ const { OFF, ON } = JitsiRecordingConstants.status;++ if (updatedSessionData.status === ON+ && (!oldSessionData || oldSessionData.status !== ON)) {+ store.dispatch(playSound(RECORDING_ON_SOUND_ID));+ } else if (updatedSessionData.status === OFF+ && (!oldSessionData || oldSessionData.status !== OFF)) {+ store.dispatch(stopSound(RECORDING_ON_SOUND_ID));+ store.dispatch(playSound(RECORDING_OFF_SOUND_ID));+ }+ }++ break;+ }}return result;diff --git a/react/features/recording/sounds.js b/react/features/recording/sounds.jsnew file mode 100644index 0000000000..21597acd96--- /dev/null+++ b/react/features/recording/sounds.js@@ -0,0 +1,15 @@+/**+ * The name of the bundled audio file which will be played for when a recording+ * or live streaming is stopped.+ *+ * @type {string}+ */+export const RECORDING_OFF_SOUND_FILE = 'recordingOff.mp3';++/**+ * The name of the bundled audio file which will be played for when a recording+ * or live streaming is started.+ *+ * @type {string}+ */+export const RECORDING_ON_SOUND_FILE = 'recordingOn.mp3';diff --git a/sounds/recordingOff.mp3 b/sounds/recordingOff.mp3new file mode 100644index 0000000000..7ac24a278bBinary files /dev/null and b/sounds/recordingOff.mp3 differdiff --git a/sounds/recordingOn.mp3 b/sounds/recordingOn.mp3new file mode 100644index 0000000000..c3f60d2015Binary files /dev/null and b/sounds/recordingOn.mp3 differ