Adds live streaming sound notification. (#4532)

* Adds live streaming sound notification.

* Adds ios resources for the new files.
This commit is contained in:
Дамян Минков 2019-08-12 18:34:38 +03:00 committed by GitHub
parent b658f20a30
commit 8800cb4580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 95 additions and 33 deletions

View File

@ -149,6 +149,8 @@ android.libraryVariants.all { def variant ->
from("${projectDir}/../../sounds/incomingMessage.wav") from("${projectDir}/../../sounds/incomingMessage.wav")
from("${projectDir}/../../sounds/joined.wav") from("${projectDir}/../../sounds/joined.wav")
from("${projectDir}/../../sounds/left.wav") from("${projectDir}/../../sounds/left.wav")
from("${projectDir}/../../sounds/liveStreamingOn.mp3")
from("${projectDir}/../../sounds/liveStreamingOff.mp3")
from("${projectDir}/../../sounds/outgoingRinging.wav") from("${projectDir}/../../sounds/outgoingRinging.wav")
from("${projectDir}/../../sounds/outgoingStart.wav") from("${projectDir}/../../sounds/outgoingStart.wav")
from("${projectDir}/../../sounds/recordingOn.mp3") from("${projectDir}/../../sounds/recordingOn.mp3")

View File

@ -27,6 +27,8 @@
0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */; }; 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, ); }; }; 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 */; }; 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 */; }; 6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC720C06D490089C899 /* recordingOn.mp3 */; };
6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC920C06D530089C899 /* recordingOff.mp3 */; }; 6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC920C06D530089C899 /* recordingOff.mp3 */; };
75635B0A20751D6D00F29C9F /* joined.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0820751D6D00F29C9F /* joined.wav */; }; 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; }; 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>"; }; 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>"; }; 0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOff.mp3; path = ../../sounds/liveStreamingOff.mp3; sourceTree = "<group>"; };
C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOn.mp3; path = ../../sounds/liveStreamingOn.mp3; sourceTree = "<group>"; };
6C31EDC720C06D490089C899 /* recordingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOn.mp3; path = ../../sounds/recordingOn.mp3; 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>"; }; 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>"; }; 75635B0820751D6D00F29C9F /* joined.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = joined.wav; path = ../../sounds/joined.wav; sourceTree = "<group>"; };
@ -135,6 +139,8 @@
0BCA496B1EC4BBF900B793EE /* jitsi.ttf */, 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */,
75635B0820751D6D00F29C9F /* joined.wav */, 75635B0820751D6D00F29C9F /* joined.wav */,
75635B0920751D6D00F29C9F /* left.wav */, 75635B0920751D6D00F29C9F /* left.wav */,
C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */,
C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */,
0B49424420AD8DBD00BD2DE0 /* outgoingRinging.wav */, 0B49424420AD8DBD00BD2DE0 /* outgoingRinging.wav */,
0B49424320AD8DBD00BD2DE0 /* outgoingStart.wav */, 0B49424320AD8DBD00BD2DE0 /* outgoingStart.wav */,
6C31EDC920C06D530089C899 /* recordingOff.mp3 */, 6C31EDC920C06D530089C899 /* recordingOff.mp3 */,
@ -343,6 +349,8 @@
files = ( files = (
87FE6F3321E52437004A5DC7 /* incomingMessage.wav in Resources */, 87FE6F3321E52437004A5DC7 /* incomingMessage.wav in Resources */,
0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */, 0B49424520AD8DBD00BD2DE0 /* outgoingStart.wav in Resources */,
C30F88D0CB0F4F5593216D24 /* liveStreamingOff.mp3 in Resources */,
C30F88D2CB0F4F5593216D24 /* liveStreamingOn.mp3 in Resources */,
6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */, 6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */,
A4414AE020B37F1A003546E6 /* rejected.wav in Resources */, A4414AE020B37F1A003546E6 /* rejected.wav in Resources */,
0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */, 0B49424620AD8DBD00BD2DE0 /* outgoingRinging.wav in Resources */,

View File

@ -2,17 +2,30 @@
import { JitsiRecordingConstants } from '../base/lib-jitsi-meet'; import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
/** /**
* The identifier of the sound to be played when a recording or live streaming * The identifier of the sound to be played when a live streaming session is stopped.
* 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} * @type {string}
*/ */
export const RECORDING_OFF_SOUND_ID = 'RECORDING_OFF_SOUND'; export const RECORDING_OFF_SOUND_ID = 'RECORDING_OFF_SOUND';
/** /**
* The identifier of the sound to be played when a recording or live streaming * The identifier of the sound to be played when a recording session is started.
* session is started.
* *
* @type {string} * @type {string}
*/ */

View File

@ -28,9 +28,16 @@ import {
updateRecordingSessionData updateRecordingSessionData
} from './actions'; } from './actions';
import { RECORDING_SESSION_UPDATED } from './actionTypes'; 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 { getSessionById } from './functions';
import { import {
LIVE_STREAMING_OFF_SOUND_FILE,
LIVE_STREAMING_ON_SOUND_FILE,
RECORDING_OFF_SOUND_FILE, RECORDING_OFF_SOUND_FILE,
RECORDING_ON_SOUND_FILE RECORDING_ON_SOUND_FILE
} from './sounds'; } from './sounds';
@ -66,6 +73,14 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
switch (action.type) { switch (action.type) {
case APP_WILL_MOUNT: 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( dispatch(registerSound(
RECORDING_OFF_SOUND_ID, RECORDING_OFF_SOUND_ID,
RECORDING_OFF_SOUND_FILE)); RECORDING_OFF_SOUND_FILE));
@ -77,6 +92,8 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
break; break;
case APP_WILL_UNMOUNT: 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_OFF_SOUND_ID));
dispatch(unregisterSound(RECORDING_ON_SOUND_ID)); dispatch(unregisterSound(RECORDING_ON_SOUND_ID));
@ -114,41 +131,51 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
const updatedSessionData const updatedSessionData
= getSessionById(getState(), action.sessionData.id); = getSessionById(getState(), action.sessionData.id);
const { mode } = updatedSessionData;
const { PENDING, OFF, ON } = JitsiRecordingConstants.status; const { PENDING, OFF, ON } = JitsiRecordingConstants.status;
if (updatedSessionData.status === PENDING if (updatedSessionData.status === PENDING
&& (!oldSessionData || oldSessionData.status !== PENDING)) { && (!oldSessionData || oldSessionData.status !== PENDING)) {
dispatch( dispatch(showPendingRecordingNotification(mode));
showPendingRecordingNotification(updatedSessionData.mode));
} else if (updatedSessionData.status !== PENDING) { } else if (updatedSessionData.status !== PENDING) {
dispatch( dispatch(hidePendingRecordingNotification(mode));
hidePendingRecordingNotification(updatedSessionData.mode));
if (updatedSessionData.status === ON if (updatedSessionData.status === ON
&& (!oldSessionData || oldSessionData.status !== ON) && (!oldSessionData || oldSessionData.status !== ON)) {
&& updatedSessionData.mode let soundID;
=== JitsiRecordingConstants.mode.FILE) {
sendAnalytics(createRecordingEvent('start', 'file')); if (mode === JitsiRecordingConstants.mode.FILE) {
dispatch(playSound(RECORDING_ON_SOUND_ID)); 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 } else if (updatedSessionData.status === OFF
&& (!oldSessionData || oldSessionData.status !== OFF)) { && (!oldSessionData || oldSessionData.status !== OFF)) {
dispatch( dispatch(showStoppedRecordingNotification(mode));
showStoppedRecordingNotification( let duration = 0, soundOff, soundOn;
updatedSessionData.mode));
if (updatedSessionData.mode if (oldSessionData && oldSessionData.timestamp) {
=== JitsiRecordingConstants.mode.FILE) { duration
let duration = 0; = (Date.now() / 1000) - oldSessionData.timestamp;
}
// eslint-disable-next-line max-depth if (mode === JitsiRecordingConstants.mode.FILE) {
if (oldSessionData && oldSessionData.timestamp) { soundOff = RECORDING_OFF_SOUND_ID;
duration soundOn = RECORDING_ON_SOUND_ID;
= (Date.now() / 1000) - oldSessionData.timestamp; } else if (mode === JitsiRecordingConstants.mode.STREAM) {
} soundOff = LIVE_STREAMING_OFF_SOUND_ID;
sendAnalytics( soundOn = LIVE_STREAMING_ON_SOUND_ID;
createRecordingEvent('stop', 'file', duration)); }
dispatch(stopSound(RECORDING_ON_SOUND_ID));
dispatch(playSound(RECORDING_OFF_SOUND_ID)); if (soundOff && soundOn) {
sendAnalytics(createRecordingEvent('stop', mode, duration));
dispatch(stopSound(soundOn));
dispatch(playSound(soundOff));
} }
} }
} }

View File

@ -1,14 +1,26 @@
/** /**
* The name of the bundled audio file which will be played for when a recording * The name of the bundled audio file which will be played for when live streaming is stopped.
* or 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} * @type {string}
*/ */
export const RECORDING_OFF_SOUND_FILE = 'recordingOff.mp3'; export const RECORDING_OFF_SOUND_FILE = 'recordingOff.mp3';
/** /**
* The name of the bundled audio file which will be played for when a recording * The name of the bundled audio file which will be played for when a recording is started.
* or live streaming is started.
* *
* @type {string} * @type {string}
*/ */

BIN
sounds/liveStreamingOff.mp3 Normal file

Binary file not shown.

BIN
sounds/liveStreamingOn.mp3 Normal file

Binary file not shown.