@ -72,7 +72,7 @@ StateListenerRegistry.register(
* @param { Store } store - The redux store .
* @returns { Function }
* /
MiddlewareRegistry . register ( ( { dispatch , getState } ) = > next = > async action = > {
MiddlewareRegistry . register ( ( { dispatch , getState } ) = > next = > action = > {
let oldSessionData ;
if ( action . type === RECORDING_SESSION_UPDATED ) {
@ -114,9 +114,11 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
const { localRecording } = getState ( ) [ 'features/base/config' ] ;
const { onlySelf } = action ;
try {
await LocalRecordingManager . startLocalRecording ( { dispatch ,
getState } , action . onlySelf ) ;
LocalRecordingManager . startLocalRecording ( {
dispatch ,
getState
} , action . onlySelf )
. then ( ( ) = > {
const props = {
descriptionKey : 'recording.on' ,
titleKey : 'dialog.recording'
@ -136,7 +138,8 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
APP . API . notifyRecordingStatusChanged (
true , 'local' , undefined , isRecorderTranscriptionsRunning ( getState ( ) ) ) ;
}
} catch ( err : any ) {
} )
. catch ( err = > {
logger . error ( 'Capture failed' , err ) ;
let descriptionKey = 'recording.error' ;
@ -160,7 +163,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
}
dispatch ( showErrorNotification ( props , NOTIFICATION_TIMEOUT_TYPE . MEDIUM ) ) ;
}
} ) ;
break ;
}
@ -205,78 +208,79 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
if ( updatedSessionData ? . status === PENDING && oldSessionData ? . status !== PENDING ) {
dispatch ( showPendingRecordingNotification ( mode ) ) ;
dispatch ( hideNotification ( START_RECORDING_NOTIFICATION_ID ) ) ;
} else {
dispatch ( hidePendingRecordingNotification ( mode ) ) ;
if ( updatedSessionData ? . status === ON ) {
// We receive 2 updates of the session status ON. The first one is from jibri when it joins.
// The second one is from jicofo which will deliever the initiator value. Since the start
// recording notification uses the initiator value we skip the jibri update and show the
// notification on the update from jicofo.
// FIXE: simplify checks when the backend start sending only one status ON update containing the
// initiator.
if ( initiator && ! oldSessionData ? . initiator ) {
if ( typeof recordingLimit === 'object' ) {
dispatch ( showRecordingLimitNotification ( mode ) ) ;
} else {
dispatch ( showStartedRecordingNotification ( mode , initiator , action . sessionData . id ) ) ;
}
}
if ( oldSessionData ? . status !== ON ) {
sendAnalytics ( createRecordingEvent ( 'start' , mode ) ) ;
let soundID ;
if ( mode === JitsiRecordingConstants . mode . FILE && ! isRecorderTranscriptionsRunning ( state ) ) {
soundID = RECORDING_ON_SOUND_ID ;
} else if ( mode === JitsiRecordingConstants . mode . STREAM ) {
soundID = LIVE_STREAMING_ON_SOUND_ID ;
}
if ( soundID ) {
dispatch ( playSound ( soundID ) ) ;
}
break ;
}
if ( typeof APP !== 'undefined' ) {
APP . API . notifyRecordingStatusChanged (
true , mode , undefined , isRecorderTranscriptionsRunning ( state ) ) ;
}
}
} else if ( updatedSessionData ? . status === OFF && oldSessionData ? . status !== OFF ) {
if ( terminator ) {
dispatch (
showStoppedRecordingNotification (
mode , getParticipantDisplayName ( state , getResourceId ( terminator ) ) ) ) ;
dispatch ( hidePendingRecordingNotification ( mode ) ) ;
if ( updatedSessionData ? . status === ON ) {
// We receive 2 updates of the session status ON. The first one is from jibri when it joins.
// The second one is from jicofo which will deliever the initiator value. Since the start
// recording notification uses the initiator value we skip the jibri update and show the
// notification on the update from jicofo.
// FIXE: simplify checks when the backend start sending only one status ON update containing the
// initiator.
if ( initiator && ! oldSessionData ? . initiator ) {
if ( typeof recordingLimit === 'object' ) {
dispatch ( showRecordingLimitNotification ( mode ) ) ;
} else {
dispatch ( showStartedRecordingNotification ( mode , initiator , action . sessionData . id ) ) ;
}
}
let duration = 0 , soundOff , soundOn ;
if ( oldSessionData ? . status !== ON ) {
sendAnalytics ( createRecordingEvent ( 'start' , mode ) ) ;
if ( oldSessionData ? . timestamp ) {
duration
= ( Date . now ( ) / 1000 ) - oldSessionData . timestamp ;
}
sendAnalytics ( createRecordingEvent ( 'stop' , mode , duration ) ) ;
let soundID ;
if ( mode === JitsiRecordingConstants . mode . FILE && ! isRecorderTranscriptionsRunning ( state ) ) {
soundOff = RECORDING_OFF_SOUND_ID ;
soundOn = RECORDING_ON_SOUND_ID ;
soundID = RECORDING_ON_SOUND_ID ;
} else if ( mode === JitsiRecordingConstants . mode . STREAM ) {
soundOff = LIVE_STREAMING_OFF_SOUND_ID ;
soundOn = LIVE_STREAMING_ON_SOUND_ID ;
soundID = LIVE_STREAMING_ON_SOUND_ID ;
}
if ( soundOff && soundOn ) {
dispatch ( stopSound ( soundOn ) ) ;
dispatch ( playSound ( soundOff ) ) ;
if ( soundID ) {
dispatch ( playSound ( soundID ) ) ;
}
if ( typeof APP !== 'undefined' ) {
APP . API . notifyRecordingStatusChanged (
fals e, mode , undefined , isRecorderTranscriptionsRunning ( state ) ) ;
tru e, mode , undefined , isRecorderTranscriptionsRunning ( state ) ) ;
}
}
} else if ( updatedSessionData ? . status === OFF && oldSessionData ? . status !== OFF ) {
if ( terminator ) {
dispatch (
showStoppedRecordingNotification (
mode , getParticipantDisplayName ( state , getResourceId ( terminator ) ) ) ) ;
}
let duration = 0 , soundOff , soundOn ;
if ( oldSessionData ? . timestamp ) {
duration
= ( Date . now ( ) / 1000 ) - oldSessionData . timestamp ;
}
sendAnalytics ( createRecordingEvent ( 'stop' , mode , duration ) ) ;
if ( mode === JitsiRecordingConstants . mode . FILE && ! isRecorderTranscriptionsRunning ( state ) ) {
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 ) {
dispatch ( stopSound ( soundOn ) ) ;
dispatch ( playSound ( soundOff ) ) ;
}
if ( typeof APP !== 'undefined' ) {
APP . API . notifyRecordingStatusChanged (
false , mode , undefined , isRecorderTranscriptionsRunning ( state ) ) ;
}
}
break ;