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(transcript) add ability to dump transcript for debugging

Saúl Ibarra Corretgé1d6529af65a4
diff --git a/config.js b/config.js
index a7eef88c1c..a5caf1597f 100644
--- a/config.js
+++ b/config.js
@@ -103,6 +103,9 @@ var config = {
// Experiment: Whether to skip interim transcriptions.
// skipInterimTranscriptions: false,
+
+ // Dump transcripts to a <transcript> element for debugging.
+ // dumpTranscript: false,
},
// Disables moderator indicators.
diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts
index 2e95e056e3..4f7c0ec184 100644
--- a/react/features/base/config/configType.ts
+++ b/react/features/base/config/configType.ts
@@ -574,6 +574,7 @@ export interface IConfig {
testing?: {
assumeBandwidth?: boolean;
disableE2EE?: boolean;
+ dumpTranscript?: boolean;
mobileXmppWsThreshold?: number;
noAutoPlayVideo?: boolean;
p2pTestMode?: boolean;
diff --git a/react/features/subtitles/middleware.ts b/react/features/subtitles/middleware.ts
index 4661444b66..2051277633 100644
--- a/react/features/subtitles/middleware.ts
+++ b/react/features/subtitles/middleware.ts
@@ -100,7 +100,7 @@ function _endpointMessageReceived({ dispatch, getState }: IStore, next: Function
const language
= state['features/base/conference'].conference
?.getLocalParticipantProperty(P_NAME_TRANSLATION_LANGUAGE);
- const { skipInterimTranscriptions } = state['features/base/config'].testing ?? {};
+ const { dumpTranscript, skipInterimTranscriptions } = state['features/base/config'].testing ?? {};
const transcriptMessageID = json.message_id;
const { name, id, avatar_url: avatarUrl } = json.participant;
@@ -146,6 +146,22 @@ function _endpointMessageReceived({ dispatch, getState }: IStore, next: Function
participant,
...txt
});
+
+ // Dump transcript in a <transcript> element for debugging purposes.
+ if (!json.is_interim && dumpTranscript) {
+ try {
+ let elem = document.body.getElementsByTagName('transcript')[0];
+
+ if (!elem) {
+ elem = document.createElement('transcript');
+ document.body.appendChild(elem);
+ }
+
+ elem.append(`${new Date(json.timestamp).toISOString()} ${participant.name}: ${text}`);
+ } catch (_) {
+ // Ignored.
+ }
+ }
}
// If the suer is not requesting transcriptions just bail.