Browse Source

feat(recording): add sounds for when recording starts and stops (#3078)

* feat(recording): add sounds for when recording starts and stops

* squash: use constants, play sounds for file only

* squash: rename recordingStopped.mp3 -> recordingOff.mp3

* squash: flip var declaration for alpha order
master
virtuacoplenny 6 years ago
parent
commit
3e79926ad4

+ 2
- 0
android/sdk/build.gradle View File

78
              from("${projectDir}/../../sounds/left.wav")
78
              from("${projectDir}/../../sounds/left.wav")
79
              from("${projectDir}/../../sounds/outgoingRinging.wav")
79
              from("${projectDir}/../../sounds/outgoingRinging.wav")
80
              from("${projectDir}/../../sounds/outgoingStart.wav")
80
              from("${projectDir}/../../sounds/outgoingStart.wav")
81
+             from("${projectDir}/../../sounds/recordingOn.mp3")
82
+             from("${projectDir}/../../sounds/recordingOff.mp3")
81
              from("${projectDir}/../../sounds/rejected.wav")
83
              from("${projectDir}/../../sounds/rejected.wav")
82
              into("${bundlePath}/assets/sounds")
84
              into("${bundlePath}/assets/sounds")
83
         }
85
         }

+ 8
- 0
ios/sdk/sdk.xcodeproj/project.pbxproj View File

29
 		0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */; };
29
 		0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */; };
30
 		0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };
30
 		0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };
31
 		0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */; };
31
 		0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */; };
32
+		6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC720C06D490089C899 /* recordingOn.mp3 */; };
33
+		6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC920C06D530089C899 /* recordingOff.mp3 */; };
32
 		75635B0A20751D6D00F29C9F /* joined.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0820751D6D00F29C9F /* joined.wav */; };
34
 		75635B0A20751D6D00F29C9F /* joined.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0820751D6D00F29C9F /* joined.wav */; };
33
 		75635B0B20751D6D00F29C9F /* left.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0920751D6D00F29C9F /* left.wav */; };
35
 		75635B0B20751D6D00F29C9F /* left.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0920751D6D00F29C9F /* left.wav */; };
34
 		A4414AE020B37F1A003546E6 /* rejected.wav in Resources */ = {isa = PBXBuildFile; fileRef = A4414ADF20B37F1A003546E6 /* rejected.wav */; };
36
 		A4414AE020B37F1A003546E6 /* rejected.wav in Resources */ = {isa = PBXBuildFile; fileRef = A4414ADF20B37F1A003546E6 /* rejected.wav */; };
78
 		0BD906E51EC0C00300C8C18E /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
80
 		0BD906E51EC0C00300C8C18E /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
79
 		0BD906E81EC0C00300C8C18E /* JitsiMeet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeet.h; sourceTree = "<group>"; };
81
 		0BD906E81EC0C00300C8C18E /* JitsiMeet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeet.h; sourceTree = "<group>"; };
80
 		0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
82
 		0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
83
+		6C31EDC720C06D490089C899 /* recordingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOn.mp3; path = ../../sounds/recordingOn.mp3; sourceTree = "<group>"; };
84
+		6C31EDC920C06D530089C899 /* recordingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOff.mp3; path = ../../sounds/recordingOff.mp3; sourceTree = "<group>"; };
81
 		75635B0820751D6D00F29C9F /* joined.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = joined.wav; path = ../../sounds/joined.wav; sourceTree = "<group>"; };
85
 		75635B0820751D6D00F29C9F /* joined.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = joined.wav; path = ../../sounds/joined.wav; sourceTree = "<group>"; };
82
 		75635B0920751D6D00F29C9F /* left.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = left.wav; path = ../../sounds/left.wav; sourceTree = "<group>"; };
86
 		75635B0920751D6D00F29C9F /* left.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = left.wav; path = ../../sounds/left.wav; sourceTree = "<group>"; };
83
 		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>"; };
87
 		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
 		0BCA49681EC4BBE500B793EE /* Resources */ = {
122
 		0BCA49681EC4BBE500B793EE /* Resources */ = {
119
 			isa = PBXGroup;
123
 			isa = PBXGroup;
120
 			children = (
124
 			children = (
125
+				6C31EDC720C06D490089C899 /* recordingOn.mp3 */,
126
+				6C31EDC920C06D530089C899 /* recordingOff.mp3 */,
121
 				A4414ADF20B37F1A003546E6 /* rejected.wav */,
127
 				A4414ADF20B37F1A003546E6 /* rejected.wav */,
122
 				0BC4B8681F8C01E100CE8B21 /* CallKitIcon.png */,
128
 				0BC4B8681F8C01E100CE8B21 /* CallKitIcon.png */,
123
 				C6245F5B2053091D0040BE68 /* image-resize@2x.png */,
129
 				C6245F5B2053091D0040BE68 /* image-resize@2x.png */,
315
 			buildActionMask = 2147483647;
321
 			buildActionMask = 2147483647;
316
 			files = (
322
 			files = (
317
 				0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */,
323
 				0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */,
324
+				6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */,
318
 				A4414AE020B37F1A003546E6 /* rejected.wav in Resources */,
325
 				A4414AE020B37F1A003546E6 /* rejected.wav in Resources */,
319
 				0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */,
326
 				0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */,
320
 				0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */,
327
 				0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */,
321
 				C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */,
328
 				C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */,
329
+				6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */,
322
 				0BC4B8691F8C03A700CE8B21 /* CallKitIcon.png in Resources */,
330
 				0BC4B8691F8C03A700CE8B21 /* CallKitIcon.png in Resources */,
323
 				75635B0B20751D6D00F29C9F /* left.wav in Resources */,
331
 				75635B0B20751D6D00F29C9F /* left.wav in Resources */,
324
 				75635B0A20751D6D00F29C9F /* joined.wav in Resources */,
332
 				75635B0A20751D6D00F29C9F /* joined.wav in Resources */,

+ 16
- 0
react/features/recording/constants.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
+/**
4
+ * The identifier of the sound to be played when a recording or live streaming
5
+ * session is stopped.
6
+ *
7
+ * @type {string}
8
+ */
9
+export const RECORDING_OFF_SOUND_ID = 'RECORDING_OFF_SOUND';
10
+
11
+/**
12
+ * The identifier of the sound to be played when a recording or live streaming
13
+ * session is started.
14
+ *
15
+ * @type {string}
16
+ */
17
+export const RECORDING_ON_SOUND_ID = 'RECORDING_ON_SOUND';
18
+
3
 /**
19
 /**
4
  * Expected supported recording types. JIBRI is known to support live streaming
20
  * Expected supported recording types. JIBRI is known to support live streaming
5
  * whereas JIRECON is for recording.
21
  * whereas JIRECON is for recording.

+ 13
- 0
react/features/recording/functions.js View File

16
         && (sessionData.status === statusConstants.ON
16
         && (sessionData.status === statusConstants.ON
17
             || sessionData.status === statusConstants.PENDING));
17
             || sessionData.status === statusConstants.PENDING));
18
 }
18
 }
19
+
20
+/**
21
+ * Searches in the passed in redux state for a recording session that matches
22
+ * the passed in recording session ID.
23
+ *
24
+ * @param {Object} state - The redux state to search in.
25
+ * @param {string} id - The ID of the recording session to find.
26
+ * @returns {Object|undefined}
27
+ */
28
+export function getSessionById(state, id) {
29
+    return state['features/recording'].sessionDatas.find(
30
+        sessionData => sessionData.id === id);
31
+}

+ 65
- 3
react/features/recording/middleware.js View File

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
 import { CONFERENCE_WILL_JOIN } from '../base/conference';
3
 import { CONFERENCE_WILL_JOIN } from '../base/conference';
4
-import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
4
+import {
5
+    JitsiConferenceEvents,
6
+    JitsiRecordingConstants
7
+} from '../base/lib-jitsi-meet';
5
 import { MiddlewareRegistry } from '../base/redux';
8
 import { MiddlewareRegistry } from '../base/redux';
9
+import {
10
+    playSound,
11
+    registerSound,
12
+    stopSound,
13
+    unregisterSound
14
+} from '../base/sounds';
15
+
16
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
6
 
17
 
7
 import { updateRecordingSessionData } from './actions';
18
 import { updateRecordingSessionData } from './actions';
19
+import { RECORDING_SESSION_UPDATED } from './actionTypes';
20
+import { RECORDING_OFF_SOUND_ID, RECORDING_ON_SOUND_ID } from './constants';
21
+import { getSessionById } from './functions';
22
+import {
23
+    RECORDING_OFF_SOUND_FILE,
24
+    RECORDING_ON_SOUND_FILE
25
+} from './sounds';
8
 
26
 
9
 /**
27
 /**
10
  * The redux middleware to handle the recorder updates in a React way.
28
  * The redux middleware to handle the recorder updates in a React way.
12
  * @param {Store} store - The redux store.
30
  * @param {Store} store - The redux store.
13
  * @returns {Function}
31
  * @returns {Function}
14
  */
32
  */
15
-MiddlewareRegistry.register(({ dispatch }) => next => action => {
33
+MiddlewareRegistry.register(store => next => action => {
34
+    let oldSessionData;
35
+
36
+    if (action.type === RECORDING_SESSION_UPDATED) {
37
+        oldSessionData
38
+            = getSessionById(store.getState(), action.sessionData.id);
39
+    }
40
+
16
     const result = next(action);
41
     const result = next(action);
17
 
42
 
18
     switch (action.type) {
43
     switch (action.type) {
44
+    case APP_WILL_MOUNT:
45
+        store.dispatch(registerSound(
46
+            RECORDING_OFF_SOUND_ID,
47
+            RECORDING_OFF_SOUND_FILE));
48
+
49
+        store.dispatch(registerSound(
50
+            RECORDING_ON_SOUND_ID,
51
+            RECORDING_ON_SOUND_FILE));
52
+
53
+        break;
54
+
55
+    case APP_WILL_UNMOUNT:
56
+        store.dispatch(unregisterSound(RECORDING_OFF_SOUND_ID));
57
+        store.dispatch(unregisterSound(RECORDING_ON_SOUND_ID));
58
+
59
+        break;
60
+
19
     case CONFERENCE_WILL_JOIN: {
61
     case CONFERENCE_WILL_JOIN: {
20
         const { conference } = action;
62
         const { conference } = action;
21
 
63
 
24
             recorderSession => {
66
             recorderSession => {
25
 
67
 
26
                 if (recorderSession && recorderSession.getID()) {
68
                 if (recorderSession && recorderSession.getID()) {
27
-                    dispatch(
69
+                    store.dispatch(
28
                         updateRecordingSessionData(recorderSession));
70
                         updateRecordingSessionData(recorderSession));
29
 
71
 
30
                     return;
72
                     return;
33
 
75
 
34
         break;
76
         break;
35
     }
77
     }
78
+
79
+    case RECORDING_SESSION_UPDATED: {
80
+        const updatedSessionData
81
+            = getSessionById(store.getState(), action.sessionData.id);
82
+
83
+        if (updatedSessionData.mode === JitsiRecordingConstants.mode.FILE) {
84
+            const { OFF, ON } = JitsiRecordingConstants.status;
85
+
86
+            if (updatedSessionData.status === ON
87
+                && (!oldSessionData || oldSessionData.status !== ON)) {
88
+                store.dispatch(playSound(RECORDING_ON_SOUND_ID));
89
+            } else if (updatedSessionData.status === OFF
90
+                && (!oldSessionData || oldSessionData.status !== OFF)) {
91
+                store.dispatch(stopSound(RECORDING_ON_SOUND_ID));
92
+                store.dispatch(playSound(RECORDING_OFF_SOUND_ID));
93
+            }
94
+        }
95
+
96
+        break;
97
+    }
36
     }
98
     }
37
 
99
 
38
     return result;
100
     return result;

+ 15
- 0
react/features/recording/sounds.js View File

1
+/**
2
+ * The name of the bundled audio file which will be played for when a recording
3
+ * or live streaming is stopped.
4
+ *
5
+ * @type {string}
6
+ */
7
+export const RECORDING_OFF_SOUND_FILE = 'recordingOff.mp3';
8
+
9
+/**
10
+ * The name of the bundled audio file which will be played for when a recording
11
+ * or live streaming is started.
12
+ *
13
+ * @type {string}
14
+ */
15
+export const RECORDING_ON_SOUND_FILE = 'recordingOn.mp3';

BIN
sounds/recordingOff.mp3 View File


BIN
sounds/recordingOn.mp3 View File


Loading…
Cancel
Save