@playkit-js/transcript 3.5.12 → 3.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -129,7 +129,10 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
if (captionData.length) {
|
|
132
|
-
|
|
132
|
+
// take metadata from the first caption, as all captions in captionData have the same language and label
|
|
133
|
+
const captionMetadata = payload.cues[0].metadata;
|
|
134
|
+
const captionKey = this._makeCaptionKey(captionMetadata.language, captionMetadata.label);
|
|
135
|
+
this._addCaptionData(captionData, captionKey);
|
|
133
136
|
this._addTranscriptItem();
|
|
134
137
|
}
|
|
135
138
|
};
|
|
@@ -151,9 +154,12 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
151
154
|
this._updateTranscriptPanel();
|
|
152
155
|
};
|
|
153
156
|
|
|
154
|
-
private _addCaptionData = (newData: CuePointData[]) => {
|
|
157
|
+
private _addCaptionData = (newData: CuePointData[], captionKey: string) => {
|
|
155
158
|
this._activeCaptionMapId = this._getCaptionMapId();
|
|
156
|
-
this._captionMap.
|
|
159
|
+
const oldData = this._captionMap.get(captionKey);
|
|
160
|
+
const newSanitizedData = this._sanitizeCaptions(newData);
|
|
161
|
+
// set the captions data according to the captionKey param
|
|
162
|
+
this._captionMap.set(captionKey, oldData ? [...oldData, ...newSanitizedData] : newSanitizedData);
|
|
157
163
|
this._isLoading = false;
|
|
158
164
|
clearTimeout(this._loadingTimeoutId);
|
|
159
165
|
this._updateTranscriptPanel();
|
|
@@ -168,9 +174,13 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
168
174
|
const activeTextTrack = allTextTracks.find(track => track.active);
|
|
169
175
|
if (activeTextTrack?.language === 'off') {
|
|
170
176
|
// use 1st captions from text-track list
|
|
171
|
-
return
|
|
177
|
+
return this._makeCaptionKey(allTextTracks[0]?.language, allTextTracks[0]?.label);
|
|
172
178
|
}
|
|
173
|
-
return
|
|
179
|
+
return this._makeCaptionKey(activeTextTrack?.language, activeTextTrack?.label);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
private _makeCaptionKey = (language?: string, label?: string): string => {
|
|
183
|
+
return `${language}-${label}`;
|
|
174
184
|
};
|
|
175
185
|
|
|
176
186
|
private _activatePlugin = (isFirstOpen = false) => {
|