fix(local-recording) Notify external api about local recording (#11887)

This commit is contained in:
Robert Pintilii 2022-07-20 18:08:52 +03:00 committed by GitHub
parent c1e9724bba
commit cb712eb4ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -1599,7 +1599,7 @@ class API {
* Notify external application (if API is enabled) that recording has started or stopped.
*
* @param {boolean} on - True if recording is on, false otherwise.
* @param {string} mode - Stream or file.
* @param {string} mode - Stream or file or local.
* @param {string} error - Error type or null if success.
* @returns {void}
*/

View File

@ -153,6 +153,9 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
dispatch(updateLocalRecordingStatus(true, onlySelf));
sendAnalytics(createRecordingEvent('started', `local${onlySelf ? '.self' : ''}`));
if (typeof APP !== 'undefined') {
APP.API.notifyRecordingStatusChanged(true, 'local');
}
} catch (err) {
logger.error('Capture failed', err);
@ -169,6 +172,10 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
titleKey: 'recording.failedToStart'
};
if (typeof APP !== 'undefined') {
APP.API.notifyRecordingStatusChanged(false, 'local', err.message);
}
dispatch(showErrorNotification(props, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
}
break;
@ -183,6 +190,9 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
if (localRecording?.notifyAllParticipants && !LocalRecordingManager.selfRecording) {
dispatch(playSound(RECORDING_OFF_SOUND_ID));
}
if (typeof APP !== 'undefined') {
APP.API.notifyRecordingStatusChanged(false, 'local');
}
}
break;
}