diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle index 148a3f301..05a754b92 100644 --- a/android/sdk/build.gradle +++ b/android/sdk/build.gradle @@ -149,6 +149,8 @@ android.libraryVariants.all { def variant -> from("${projectDir}/../../sounds/incomingMessage.wav") from("${projectDir}/../../sounds/joined.wav") from("${projectDir}/../../sounds/left.wav") + from("${projectDir}/../../sounds/liveStreamingOn.mp3") + from("${projectDir}/../../sounds/liveStreamingOff.mp3") from("${projectDir}/../../sounds/outgoingRinging.wav") from("${projectDir}/../../sounds/outgoingStart.wav") from("${projectDir}/../../sounds/recordingOn.mp3") diff --git a/ios/sdk/sdk.xcodeproj/project.pbxproj b/ios/sdk/sdk.xcodeproj/project.pbxproj index a24b4ab6b..f0fedf72b 100644 --- a/ios/sdk/sdk.xcodeproj/project.pbxproj +++ b/ios/sdk/sdk.xcodeproj/project.pbxproj @@ -27,6 +27,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 */; }; + C30F88D0CB0F4F5593216D24 /* liveStreamingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */; }; + C30F88D2CB0F4F5593216D24 /* liveStreamingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */; }; 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 */; }; @@ -77,6 +79,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 = ""; }; 0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOff.mp3; path = ../../sounds/liveStreamingOff.mp3; sourceTree = ""; }; + C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOn.mp3; path = ../../sounds/liveStreamingOn.mp3; sourceTree = ""; }; 6C31EDC720C06D490089C899 /* recordingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOn.mp3; path = ../../sounds/recordingOn.mp3; sourceTree = ""; }; 6C31EDC920C06D530089C899 /* recordingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOff.mp3; path = ../../sounds/recordingOff.mp3; sourceTree = ""; }; 75635B0820751D6D00F29C9F /* joined.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = joined.wav; path = ../../sounds/joined.wav; sourceTree = ""; }; @@ -135,6 +139,8 @@ 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */, 75635B0820751D6D00F29C9F /* joined.wav */, 75635B0920751D6D00F29C9F /* left.wav */, + C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */, + C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */, 0B49424420AD8DBD00BD2DE0 /* outgoingRinging.wav */, 0B49424320AD8DBD00BD2DE0 /* outgoingStart.wav */, 6C31EDC920C06D530089C899 /* recordingOff.mp3 */, @@ -343,6 +349,8 @@ files = ( 87FE6F3321E52437004A5DC7 /* incomingMessage.wav in Resources */, 0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */, + C30F88D0CB0F4F5593216D24 /* liveStreamingOff.mp3 in Resources */, + C30F88D2CB0F4F5593216D24 /* liveStreamingOn.mp3 in Resources */, 6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */, A4414AE020B37F1A003546E6 /* rejected.wav in Resources */, 0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */, diff --git a/react/features/recording/constants.js b/react/features/recording/constants.js index 4304d88e9..706e608bb 100644 --- a/react/features/recording/constants.js +++ b/react/features/recording/constants.js @@ -2,17 +2,30 @@ import { JitsiRecordingConstants } from '../base/lib-jitsi-meet'; + /** - * The identifier of the sound to be played when a recording or live streaming - * session is stopped. + * The identifier of the sound to be played when a live streaming session is stopped. + * + * @type {string} + */ +export const LIVE_STREAMING_OFF_SOUND_ID = 'LIVE_STREAMING_OFF_SOUND'; + +/** + * The identifier of the sound to be played when a live streaming session is started. + * + * @type {string} + */ +export const LIVE_STREAMING_ON_SOUND_ID = 'LIVE_STREAMING_ON_SOUND'; + +/** + * The identifier of the sound to be played when a recording 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. + * The identifier of the sound to be played when a recording session is started. * * @type {string} */ diff --git a/react/features/recording/middleware.js b/react/features/recording/middleware.js index dae5036e5..23a90f7f9 100644 --- a/react/features/recording/middleware.js +++ b/react/features/recording/middleware.js @@ -28,9 +28,16 @@ import { updateRecordingSessionData } from './actions'; import { RECORDING_SESSION_UPDATED } from './actionTypes'; -import { RECORDING_OFF_SOUND_ID, RECORDING_ON_SOUND_ID } from './constants'; +import { + LIVE_STREAMING_OFF_SOUND_ID, + LIVE_STREAMING_ON_SOUND_ID, + RECORDING_OFF_SOUND_ID, + RECORDING_ON_SOUND_ID +} from './constants'; import { getSessionById } from './functions'; import { + LIVE_STREAMING_OFF_SOUND_FILE, + LIVE_STREAMING_ON_SOUND_FILE, RECORDING_OFF_SOUND_FILE, RECORDING_ON_SOUND_FILE } from './sounds'; @@ -66,6 +73,14 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { switch (action.type) { case APP_WILL_MOUNT: + dispatch(registerSound( + LIVE_STREAMING_OFF_SOUND_ID, + LIVE_STREAMING_OFF_SOUND_FILE)); + + dispatch(registerSound( + LIVE_STREAMING_ON_SOUND_ID, + LIVE_STREAMING_ON_SOUND_FILE)); + dispatch(registerSound( RECORDING_OFF_SOUND_ID, RECORDING_OFF_SOUND_FILE)); @@ -77,6 +92,8 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { break; case APP_WILL_UNMOUNT: + dispatch(unregisterSound(LIVE_STREAMING_OFF_SOUND_ID)); + dispatch(unregisterSound(LIVE_STREAMING_ON_SOUND_ID)); dispatch(unregisterSound(RECORDING_OFF_SOUND_ID)); dispatch(unregisterSound(RECORDING_ON_SOUND_ID)); @@ -114,41 +131,51 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { const updatedSessionData = getSessionById(getState(), action.sessionData.id); + const { mode } = updatedSessionData; const { PENDING, OFF, ON } = JitsiRecordingConstants.status; if (updatedSessionData.status === PENDING && (!oldSessionData || oldSessionData.status !== PENDING)) { - dispatch( - showPendingRecordingNotification(updatedSessionData.mode)); + dispatch(showPendingRecordingNotification(mode)); } else if (updatedSessionData.status !== PENDING) { - dispatch( - hidePendingRecordingNotification(updatedSessionData.mode)); + dispatch(hidePendingRecordingNotification(mode)); if (updatedSessionData.status === ON - && (!oldSessionData || oldSessionData.status !== ON) - && updatedSessionData.mode - === JitsiRecordingConstants.mode.FILE) { - sendAnalytics(createRecordingEvent('start', 'file')); - dispatch(playSound(RECORDING_ON_SOUND_ID)); + && (!oldSessionData || oldSessionData.status !== ON)) { + let soundID; + + if (mode === JitsiRecordingConstants.mode.FILE) { + soundID = RECORDING_ON_SOUND_ID; + } else if (mode === JitsiRecordingConstants.mode.STREAM) { + soundID = LIVE_STREAMING_ON_SOUND_ID; + } + + if (soundID) { + sendAnalytics(createRecordingEvent('start', mode)); + dispatch(playSound(soundID)); + } } else if (updatedSessionData.status === OFF && (!oldSessionData || oldSessionData.status !== OFF)) { - dispatch( - showStoppedRecordingNotification( - updatedSessionData.mode)); + dispatch(showStoppedRecordingNotification(mode)); + let duration = 0, soundOff, soundOn; - if (updatedSessionData.mode - === JitsiRecordingConstants.mode.FILE) { - let duration = 0; + if (oldSessionData && oldSessionData.timestamp) { + duration + = (Date.now() / 1000) - oldSessionData.timestamp; + } - // eslint-disable-next-line max-depth - if (oldSessionData && oldSessionData.timestamp) { - duration - = (Date.now() / 1000) - oldSessionData.timestamp; - } - sendAnalytics( - createRecordingEvent('stop', 'file', duration)); - dispatch(stopSound(RECORDING_ON_SOUND_ID)); - dispatch(playSound(RECORDING_OFF_SOUND_ID)); + if (mode === JitsiRecordingConstants.mode.FILE) { + soundOff = RECORDING_OFF_SOUND_ID; + soundOn = RECORDING_ON_SOUND_ID; + } else if (mode === JitsiRecordingConstants.mode.STREAM) { + soundOff = LIVE_STREAMING_OFF_SOUND_ID; + soundOn = LIVE_STREAMING_ON_SOUND_ID; + } + + if (soundOff && soundOn) { + sendAnalytics(createRecordingEvent('stop', mode, duration)); + dispatch(stopSound(soundOn)); + dispatch(playSound(soundOff)); } } } diff --git a/react/features/recording/sounds.js b/react/features/recording/sounds.js index 21597acd9..041ea8219 100644 --- a/react/features/recording/sounds.js +++ b/react/features/recording/sounds.js @@ -1,14 +1,26 @@ /** - * The name of the bundled audio file which will be played for when a recording - * or live streaming is stopped. + * The name of the bundled audio file which will be played for when live streaming is stopped. + * + * @type {string} + */ +export const LIVE_STREAMING_OFF_SOUND_FILE = 'liveStreamingOff.mp3'; + +/** + * The name of the bundled audio file which will be played for when a live streaming is started. + * + * @type {string} + */ +export const LIVE_STREAMING_ON_SOUND_FILE = 'liveStreamingOn.mp3'; + +/** + * The name of the bundled audio file which will be played for when a recording 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. + * The name of the bundled audio file which will be played for when a recording is started. * * @type {string} */ diff --git a/sounds/liveStreamingOff.mp3 b/sounds/liveStreamingOff.mp3 new file mode 100644 index 000000000..186129b2b Binary files /dev/null and b/sounds/liveStreamingOff.mp3 differ diff --git a/sounds/liveStreamingOn.mp3 b/sounds/liveStreamingOn.mp3 new file mode 100644 index 000000000..5bc319301 Binary files /dev/null and b/sounds/liveStreamingOn.mp3 differ