Przeglądaj źródła

feat(transcript) add ability to dump transcript for debugging

factor2
Saúl Ibarra Corretgé 1 rok temu
rodzic
commit
1d6529af65

+ 3
- 0
config.js Wyświetl plik

@@ -103,6 +103,9 @@ var config = {
103 103
 
104 104
         // Experiment: Whether to skip interim transcriptions.
105 105
         // skipInterimTranscriptions: false,
106
+
107
+        // Dump transcripts to a <transcript> element for debugging.
108
+        // dumpTranscript: false,
106 109
     },
107 110
 
108 111
     // Disables moderator indicators.

+ 1
- 0
react/features/base/config/configType.ts Wyświetl plik

@@ -574,6 +574,7 @@ export interface IConfig {
574 574
     testing?: {
575 575
         assumeBandwidth?: boolean;
576 576
         disableE2EE?: boolean;
577
+        dumpTranscript?: boolean;
577 578
         mobileXmppWsThreshold?: number;
578 579
         noAutoPlayVideo?: boolean;
579 580
         p2pTestMode?: boolean;

+ 17
- 1
react/features/subtitles/middleware.ts Wyświetl plik

@@ -100,7 +100,7 @@ function _endpointMessageReceived({ dispatch, getState }: IStore, next: Function
100 100
     const language
101 101
         = state['features/base/conference'].conference
102 102
             ?.getLocalParticipantProperty(P_NAME_TRANSLATION_LANGUAGE);
103
-    const { skipInterimTranscriptions } = state['features/base/config'].testing ?? {};
103
+    const { dumpTranscript, skipInterimTranscriptions } = state['features/base/config'].testing ?? {};
104 104
 
105 105
     const transcriptMessageID = json.message_id;
106 106
     const { name, id, avatar_url: avatarUrl } = json.participant;
@@ -146,6 +146,22 @@ function _endpointMessageReceived({ dispatch, getState }: IStore, next: Function
146 146
                 participant,
147 147
                 ...txt
148 148
             });
149
+
150
+            // Dump transcript in a <transcript> element for debugging purposes.
151
+            if (!json.is_interim && dumpTranscript) {
152
+                try {
153
+                    let elem = document.body.getElementsByTagName('transcript')[0];
154
+
155
+                    if (!elem) {
156
+                        elem = document.createElement('transcript');
157
+                        document.body.appendChild(elem);
158
+                    }
159
+
160
+                    elem.append(`${new Date(json.timestamp).toISOString()} ${participant.name}: ${text}`);
161
+                } catch (_) {
162
+                    // Ignored.
163
+                }
164
+            }
149 165
         }
150 166
 
151 167
         // If the suer is not requesting transcriptions just bail.

Ładowanie…
Anuluj
Zapisz