Skip to content

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

fix: Fix reading transcription results from JVB. (#16725)

bgrozev96c5a9abd19d
diff --git a/react/features/base/participants/constants.ts b/react/features/base/participants/constants.ts
index ee4cd03e1d..d2518eda9a 100644
--- a/react/features/base/participants/constants.ts
+++ b/react/features/base/participants/constants.ts
@@ -80,3 +80,8 @@ export const LOWER_HAND_AUDIO_LEVEL = 0.2;
* Icon URL for the whiteboard participant.
*/
export const WHITEBOARD_PARTICIPANT_ICON = IconWhiteboard;
+
+/**
+ * The ID used for non-participant (system) messages coming from a transcriber.
+ */
+export const TRANSCRIBER_ID = 'transcriber';
diff --git a/react/features/subtitles/middleware.ts b/react/features/subtitles/middleware.ts
index 6bf65535ed..8bc064bb40 100644
--- a/react/features/subtitles/middleware.ts
+++ b/react/features/subtitles/middleware.ts
@@ -5,6 +5,7 @@ import { ENDPOINT_MESSAGE_RECEIVED, NON_PARTICIPANT_MESSAGE_RECEIVED } from '../
import { MEET_FEATURES } from '../base/jwt/constants';
import { isJwtFeatureEnabled } from '../base/jwt/functions';
import JitsiMeetJS from '../base/lib-jitsi-meet';
+import { TRANSCRIBER_ID } from '../base/participants/constants';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { showErrorNotification } from '../notifications/actions';
import { TRANSCRIBER_JOINED } from '../transcribing/actionTypes';
@@ -118,7 +119,18 @@ MiddlewareRegistry.register(store => next => action => {
* @returns {Object} The value returned by {@code next(action)}.
*/
function _endpointMessageReceived(store: IStore, next: Function, action: AnyAction) {
- const { data: json } = action;
+ let json: any = {};
+
+ if (action.type === ENDPOINT_MESSAGE_RECEIVED) {
+ if (!action.participant.isHidden()) {
+ return next(action);
+ }
+ json = action.data;
+ } else if (action.type === NON_PARTICIPANT_MESSAGE_RECEIVED && action.id === TRANSCRIBER_ID) {
+ json = action.json;
+ } else {
+ return next(action);
+ }
if (![ JSON_TYPE_TRANSCRIPTION_RESULT, JSON_TYPE_TRANSLATION_RESULT ].includes(json?.type)) {
return next(action);