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
This commit is contained in:
virtuacoplenny 2018-06-05 11:20:43 -07:00 committed by Paweł Domas
parent ff0d42a95b
commit 3e79926ad4
8 changed files with 119 additions and 3 deletions

View File

@ -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")
}

View File

@ -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 /* image-resize@2x.png */,
@ -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 /* image-resize@2x.png in Resources */,
6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */,
0BC4B8691F8C03A700CE8B21 /* CallKitIcon.png in Resources */,
75635B0B20751D6D00F29C9F /* left.wav in Resources */,
75635B0A20751D6D00F29C9F /* joined.wav in Resources */,

View File

@ -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.

View File

@ -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);
}

View File

@ -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;

View File

@ -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';

BIN
sounds/recordingOff.mp3 Normal file

Binary file not shown.

BIN
sounds/recordingOn.mp3 Normal file

Binary file not shown.