|
@@ -10,8 +10,6 @@ import {
|
10
|
10
|
|
11
|
11
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
12
|
12
|
|
13
|
|
-declare var APP: Object;
|
14
|
|
-
|
15
|
13
|
/**
|
16
|
14
|
* The type of json-message which indicates that json carries a
|
17
|
15
|
* transcription result.
|
|
@@ -85,16 +83,15 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
|
85
|
83
|
|
86
|
84
|
const newTranscriptMessage = {
|
87
|
85
|
participantName,
|
88
|
|
- final: json.text
|
|
86
|
+ final: json.text,
|
|
87
|
+ clearTimeOut: undefined
|
89
|
88
|
};
|
90
|
89
|
|
|
90
|
+ setClearerOnTranscriptMessage(dispatch,
|
|
91
|
+ transcriptMessageID, newTranscriptMessage);
|
91
|
92
|
dispatch(updateTranscriptMessage(transcriptMessageID,
|
92
|
93
|
newTranscriptMessage));
|
93
|
94
|
|
94
|
|
- setTimeout(() => {
|
95
|
|
- dispatch(removeTranscriptMessage(transcriptMessageID));
|
96
|
|
- }, REMOVE_AFTER_MS);
|
97
|
|
-
|
98
|
95
|
} else if (json.type === JSON_TYPE_TRANSCRIPTION_RESULT
|
99
|
96
|
&& !translationLanguage) {
|
100
|
97
|
// Displays interim and final results without any translation if
|
|
@@ -109,6 +106,9 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
|
109
|
106
|
= { ...getState()['features/subtitles'].transcriptMessages
|
110
|
107
|
.get(transcriptMessageID) || { participantName } };
|
111
|
108
|
|
|
109
|
+ setClearerOnTranscriptMessage(dispatch,
|
|
110
|
+ transcriptMessageID, newTranscriptMessage);
|
|
111
|
+
|
112
|
112
|
// If this is final result, update the state as a final result
|
113
|
113
|
// and start a count down to remove the subtitle from the state
|
114
|
114
|
if (!isInterim) {
|
|
@@ -116,10 +116,6 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
|
116
|
116
|
newTranscriptMessage.final = text;
|
117
|
117
|
dispatch(updateTranscriptMessage(transcriptMessageID,
|
118
|
118
|
newTranscriptMessage));
|
119
|
|
-
|
120
|
|
- setTimeout(() => {
|
121
|
|
- dispatch(removeTranscriptMessage(transcriptMessageID));
|
122
|
|
- }, REMOVE_AFTER_MS);
|
123
|
119
|
} else if (stability > 0.85) {
|
124
|
120
|
|
125
|
121
|
// If the message has a high stability, we can update the
|
|
@@ -146,3 +142,26 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
|
146
|
142
|
|
147
|
143
|
return next(action);
|
148
|
144
|
}
|
|
145
|
+
|
|
146
|
+/**
|
|
147
|
+ * Set a timeout on a TranscriptMessage object so it clears itself when it's not
|
|
148
|
+ * updated.
|
|
149
|
+ *
|
|
150
|
+ * @param {Function} dispatch - Dispatch remove action to store.
|
|
151
|
+ * @param {string} transcriptMessageID - The id of the message to remove.
|
|
152
|
+ * @param {Object} transcriptMessage - The message to remove.
|
|
153
|
+ *
|
|
154
|
+ * @returns {void}
|
|
155
|
+ */
|
|
156
|
+function setClearerOnTranscriptMessage(
|
|
157
|
+ dispatch,
|
|
158
|
+ transcriptMessageID,
|
|
159
|
+ transcriptMessage) {
|
|
160
|
+ if (transcriptMessage.clearTimeOut) {
|
|
161
|
+ clearTimeout(transcriptMessage.clearTimeOut);
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ transcriptMessage.clearTimeOut = setTimeout(() => {
|
|
165
|
+ dispatch(removeTranscriptMessage(transcriptMessageID));
|
|
166
|
+ }, REMOVE_AFTER_MS);
|
|
167
|
+}
|