@playkit-js/transcript 3.5.24 → 3.5.25-canary.0-81ec3e1
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
|
@@ -27,6 +27,8 @@ interface TimedMetadataEvent {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
30
|
+
public displayName = 'Transcript';
|
|
31
|
+
public svgIcon = {path: icons.PLUGIN_ICON, viewBox: '0 0 32 32'};
|
|
30
32
|
static defaultConfig: TranscriptConfig = {
|
|
31
33
|
expandMode: SidePanelModes.ALONGSIDE,
|
|
32
34
|
expandOnFirstPlay: true,
|
|
@@ -48,6 +50,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
48
50
|
|
|
49
51
|
private _transcriptPanel = -1;
|
|
50
52
|
private _transcriptIcon = -1;
|
|
53
|
+
private _audioPlayerIconId = -1;
|
|
51
54
|
private _pluginState: PluginStates | null = null;
|
|
52
55
|
private _pluginButtonRef: HTMLButtonElement | null = null;
|
|
53
56
|
|
|
@@ -111,6 +114,10 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
111
114
|
this._updateTranscriptPanel();
|
|
112
115
|
};
|
|
113
116
|
|
|
117
|
+
public open(): void {
|
|
118
|
+
this._handleDetach();
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
private _handleLanguageChange = () => {
|
|
115
122
|
this._activeCaptionMapId = this._getCaptionMapId();
|
|
116
123
|
this._initLoading();
|
|
@@ -271,11 +278,10 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
271
278
|
};
|
|
272
279
|
|
|
273
280
|
private _addTranscriptItem(): void {
|
|
274
|
-
if (Math.max(this._transcriptPanel, this._transcriptIcon) > 0) {
|
|
281
|
+
if (Math.max(this._transcriptPanel, this._transcriptIcon, this._audioPlayerIconId) > 0) {
|
|
275
282
|
// transcript panel or icon already exist
|
|
276
283
|
return;
|
|
277
284
|
}
|
|
278
|
-
|
|
279
285
|
const {
|
|
280
286
|
expandMode,
|
|
281
287
|
position,
|
|
@@ -331,29 +337,36 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
331
337
|
showTranscript: <Text id="transcript.show_plugin">Show Transcript</Text>,
|
|
332
338
|
hideTranscript: <Text id="transcript.hide_plugin">Hide Transcript</Text>
|
|
333
339
|
};
|
|
334
|
-
|
|
335
|
-
|
|
340
|
+
// @ts-ignore
|
|
341
|
+
if (ui.redux.useStore().getState().shell['activePresetName'] !== ReservedPresetNames.MiniAudioUI) {
|
|
342
|
+
this._transcriptIcon = this.upperBarManager!.add({
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
344
|
+
// @ts-ignore
|
|
345
|
+
displayName: 'Transcript',
|
|
346
|
+
ariaLabel: 'Transcript',
|
|
347
|
+
order: 30,
|
|
348
|
+
svgIcon: {path: icons.PLUGIN_ICON, viewBox: `0 0 ${icons.BigSize} ${icons.BigSize}`},
|
|
349
|
+
onClick: this._handleClickOnPluginIcon as () => void,
|
|
350
|
+
component: withText(translates)((props: {showTranscript: string; hideTranscript: string}) => {
|
|
351
|
+
const isActive = this._isPluginActive();
|
|
352
|
+
const label = isActive ? props.hideTranscript : props.showTranscript;
|
|
353
|
+
return (
|
|
354
|
+
<PluginButton
|
|
355
|
+
isActive={isActive}
|
|
356
|
+
id={pluginName}
|
|
357
|
+
label={label}
|
|
358
|
+
icon={icons.PLUGIN_ICON}
|
|
359
|
+
dataTestId="transcript_pluginButton"
|
|
360
|
+
setRef={this._setPluginButtonRef}
|
|
361
|
+
/>
|
|
362
|
+
);
|
|
363
|
+
})
|
|
364
|
+
}) as number;
|
|
365
|
+
} else {
|
|
366
|
+
const {displayName, svgIcon} = this;
|
|
336
367
|
// @ts-ignore
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
order: 30,
|
|
340
|
-
svgIcon: {path: icons.PLUGIN_ICON, viewBox: `0 0 ${icons.BigSize} ${icons.BigSize}`},
|
|
341
|
-
onClick: this._handleClickOnPluginIcon as () => void,
|
|
342
|
-
component: withText(translates)((props: {showTranscript: string; hideTranscript: string}) => {
|
|
343
|
-
const isActive = this._isPluginActive();
|
|
344
|
-
const label = isActive ? props.hideTranscript : props.showTranscript;
|
|
345
|
-
return (
|
|
346
|
-
<PluginButton
|
|
347
|
-
isActive={isActive}
|
|
348
|
-
id={pluginName}
|
|
349
|
-
label={label}
|
|
350
|
-
icon={icons.PLUGIN_ICON}
|
|
351
|
-
dataTestId="transcript_pluginButton"
|
|
352
|
-
setRef={this._setPluginButtonRef}
|
|
353
|
-
/>
|
|
354
|
-
);
|
|
355
|
-
})
|
|
356
|
-
}) as number;
|
|
368
|
+
this._audioPlayerIconId = this.player.getService('AudioPluginsManager').add({displayName, svgIcon, onClick: (e) => this.open(e)});
|
|
369
|
+
}
|
|
357
370
|
|
|
358
371
|
if ((expandOnFirstPlay && !this._pluginState) || this._pluginState === PluginStates.OPENED) {
|
|
359
372
|
this._activatePlugin(true);
|
|
@@ -397,10 +410,6 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
397
410
|
this._pluginState = PluginStates.CLOSED;
|
|
398
411
|
};
|
|
399
412
|
|
|
400
|
-
public isPluginAvailable = () => {
|
|
401
|
-
return this._captionMap.size > 0;
|
|
402
|
-
};
|
|
403
|
-
|
|
404
413
|
static isValid(): boolean {
|
|
405
414
|
return true;
|
|
406
415
|
}
|
|
@@ -410,8 +419,11 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
410
419
|
if (Math.max(this._transcriptPanel, this._transcriptIcon) > 0) {
|
|
411
420
|
this.sidePanelsManager?.remove(this._transcriptPanel);
|
|
412
421
|
this.upperBarManager!.remove(this._transcriptIcon);
|
|
422
|
+
// @ts-ignore
|
|
423
|
+
this.player.getService('AudioPluginsManager').remove(this._audioPlayerIconId);
|
|
413
424
|
this._transcriptPanel = -1;
|
|
414
425
|
this._transcriptIcon = -1;
|
|
426
|
+
this._audioPlayerIconId = -1;
|
|
415
427
|
this._pluginButtonRef = null;
|
|
416
428
|
}
|
|
417
429
|
this._captionMap = new Map();
|