Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(external-api) add transcribingStatusChanged event

Saúl Ibarra Corretgéc806a432f311
diff --git a/modules/API/API.js b/modules/API/API.js
index 77a77c15d3..c784369fff 100644
--- a/modules/API/API.js
+++ b/modules/API/API.js
@@ -1975,6 +1975,19 @@ class API {
});
}
+ /**
+ * Notify external application (if API is enabled) that transcribing has started or stopped.
+ *
+ * @param {boolean} on - True if transcribing is on, false otherwise.
+ * @returns {void}
+ */
+ notifyTranscribingStatusChanged(on) {
+ this._sendEvent({
+ name: 'transcribing-status-changed',
+ on
+ });
+ }
+
/**
* Notify external application (if API is enabled) that the user received
* a transcription chunk.
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index 002fc07425..ce98070218 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -160,6 +160,7 @@ const events = {
'suspend-detected': 'suspendDetected',
'tile-view-changed': 'tileViewChanged',
'toolbar-button-clicked': 'toolbarButtonClicked',
+ 'transcribing-status-changed': 'transcribingStatusChanged',
'transcription-chunk-received': 'transcriptionChunkReceived',
'whiteboard-status-changed': 'whiteboardStatusChanged'
};
diff --git a/react/features/transcribing/middleware.ts b/react/features/transcribing/middleware.ts
index 49acf03785..1638b82537 100644
--- a/react/features/transcribing/middleware.ts
+++ b/react/features/transcribing/middleware.ts
@@ -38,6 +38,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
switch (action.type) {
case _TRANSCRIBER_JOINED: {
+ notifyTranscribingStatusChanged(true);
dispatch(showStartedTranscribingNotification());
const state = getState();
@@ -50,6 +51,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
break;
}
case _TRANSCRIBER_LEFT: {
+ notifyTranscribingStatusChanged(false);
dispatch(showStoppedTranscribingNotification());
const state = getState();
@@ -83,7 +85,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
break;
}
-
case SET_REQUESTING_SUBTITLES:
if (action.enabled && !isTranscribing) {
dispatch(showPendingTranscribingNotification());
@@ -95,3 +96,15 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
return next(action);
});
+
+/**
+ * Notify external application (if API is enabled) that transcribing has started or stopped.
+ *
+ * @param {boolean} on - True if transcribing is on, false otherwise.
+ * @returns {void}
+ */
+function notifyTranscribingStatusChanged(on: boolean) {
+ if (typeof APP !== 'undefined') {
+ APP.API.notifyTranscribingStatusChanged(on);
+ }
+}