feat(external_api) add event with transcription chunks

pull/14029/head jitsi-meet_9072
Saúl Ibarra Corretgé 2 years ago committed by Saúl Ibarra Corretgé
parent 29dbcb309d
commit c530bdd107
  1. 14
      modules/API/API.js
  2. 1
      modules/API/external/external_api.js
  3. 13
      react/features/subtitles/middleware.ts

@ -1987,6 +1987,20 @@ class API {
});
}
/**
* Notify external application (if API is enabled) that the user received
* a transcription chunk.
*
* @param {Object} data - The event data.
* @returns {void}
*/
notifyTranscriptionChunkReceived(data) {
this._sendEvent({
name: 'transcription-chunk-received',
data
});
}
/**
* Notify external application (if API is enabled) whether the used browser is supported or not.
*

@ -160,6 +160,7 @@ const events = {
'suspend-detected': 'suspendDetected',
'tile-view-changed': 'tileViewChanged',
'toolbar-button-clicked': 'toolbarButtonClicked',
'transcription-chunk-received': 'transcriptionChunkReceived',
'whiteboard-status-changed': 'whiteboardStatusChanged'
};

@ -153,10 +153,15 @@ function _endpointMessageReceived({ dispatch, getState }: IStore, next: Function
newTranscriptMessage.unstable = text;
}
dispatch(
updateTranscriptMessage(
transcriptMessageID,
newTranscriptMessage));
dispatch(updateTranscriptMessage(transcriptMessageID, newTranscriptMessage));
// Notify the external API too.
if (typeof APP !== 'undefined') {
APP.API.notifyTranscriptionChunkReceived({
messageID: transcriptMessageID,
...newTranscriptMessage
});
}
}
} catch (error) {
logger.error('Error occurred while updating transcriptions\n', error);

Loading…
Cancel
Save