@playkit-js/transcript 3.5.9 → 3.5.10-canary.0-7fdf771
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/CHANGELOG.md +8 -1
- package/dist/playkit-transcript.js +1 -1
- package/dist/playkit-transcript.js.map +1 -1
- package/package.json +6 -8
- package/src/components/popover-menu/popover-menu.scss +0 -13
- package/src/components/transcript/transcript.tsx +4 -0
- package/src/events/events.ts +9 -0
- package/src/events/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/transcript-plugin.tsx +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playkit-js/transcript",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.10-canary.0-7fdf771",
|
|
4
4
|
"main": "dist/playkit-transcript.js",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"private": false,
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"url": "git+https://github.com/kaltura/playkit-js-transcript.git"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@playkit-js/kaltura-player-js": "
|
|
16
|
+
"@playkit-js/kaltura-player-js": "3.17.9",
|
|
17
|
+
"@playkit-js/playkit-js-ui": "0.78.0",
|
|
18
|
+
"@playkit-js/ui-managers": "1.5.2",
|
|
17
19
|
"@types/sanitize-html": "^2.9.3",
|
|
18
20
|
"conventional-github-releaser": "3.1.3",
|
|
19
21
|
"copyfiles": "^2.4.1",
|
|
@@ -21,7 +23,6 @@
|
|
|
21
23
|
"css-loader": "^6.7.1",
|
|
22
24
|
"cypress": "^12.12.0",
|
|
23
25
|
"playwright-webkit": "^1.33.0",
|
|
24
|
-
"preact": "^10.4.1",
|
|
25
26
|
"prettier": "^2.6.2",
|
|
26
27
|
"rimraf": "^5.0.5",
|
|
27
28
|
"sass": "^1.54.3",
|
|
@@ -30,13 +31,12 @@
|
|
|
30
31
|
"style-loader": "1.3.0",
|
|
31
32
|
"ts-loader": "^9.3.0",
|
|
32
33
|
"typescript": "^4.9.4",
|
|
33
|
-
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
34
34
|
"webpack": "^5.72.1",
|
|
35
35
|
"webpack-cli": "^4.9.2",
|
|
36
36
|
"webpack-dev-server": "^4.9.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@playkit-js/kaltura-player-js": "
|
|
39
|
+
"@playkit-js/kaltura-player-js": "3.17.9"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"clean": "rimraf ./dist",
|
|
@@ -77,9 +77,7 @@
|
|
|
77
77
|
"html5 player"
|
|
78
78
|
],
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@playkit-js/common": "
|
|
81
|
-
"@playkit-js/playkit-js-ui": "^0.77.3",
|
|
82
|
-
"@playkit-js/ui-managers": "^1.3.11",
|
|
80
|
+
"@playkit-js/common": "1.5.9",
|
|
83
81
|
"sanitize-html": "^2.11.0",
|
|
84
82
|
"stream-browserify": "^3.0.0"
|
|
85
83
|
},
|
|
@@ -12,6 +12,7 @@ import {TranscriptMenu} from '../transcript-menu';
|
|
|
12
12
|
import {SmallScreenSlate} from '../small-screen-slate';
|
|
13
13
|
import {Button, ButtonType, ButtonSize} from '@playkit-js/common/dist/components/button';
|
|
14
14
|
import {OnClickEvent, OnClick} from '@playkit-js/common/dist/hoc/a11y-wrapper';
|
|
15
|
+
import { TranscriptEvents } from "../../events";
|
|
15
16
|
|
|
16
17
|
const {ENTER, SPACE, TAB} = ui.utils.KeyMap;
|
|
17
18
|
const {withText, Text} = ui.preacti18n;
|
|
@@ -52,6 +53,7 @@ export interface TranscriptProps {
|
|
|
52
53
|
onPrint: () => void;
|
|
53
54
|
smallScreen?: boolean;
|
|
54
55
|
expandMode?: string;
|
|
56
|
+
dispatcher: (name: string, payload?: any) => void;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
interface TranscriptState {
|
|
@@ -168,6 +170,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
|
168
170
|
searchMap[caption.id] = {...searchMap[caption.id], [index]: i};
|
|
169
171
|
});
|
|
170
172
|
});
|
|
173
|
+
this.props.dispatcher(TranscriptEvents.TRANSCRIPT_SEARCH, {search: state.search});
|
|
171
174
|
return {
|
|
172
175
|
searchMap,
|
|
173
176
|
totalSearchResults: index,
|
|
@@ -183,6 +186,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
|
183
186
|
activeSearchIndex: index,
|
|
184
187
|
isAutoScrollEnabled: false
|
|
185
188
|
});
|
|
189
|
+
this.props.dispatcher(TranscriptEvents.TRANSCRIPT_NAVIGATE_RESULT, {index});
|
|
186
190
|
};
|
|
187
191
|
|
|
188
192
|
private _getHeaderStyles = (): string => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
export const TranscriptEvents = {
|
|
3
|
+
TRANSCRIPT_OPEN: 'transcript_open',
|
|
4
|
+
TRANSCRIPT_CLOSE: 'transcript_close',
|
|
5
|
+
TRANSCRIPT_DOWNLOAD: 'transcript_download',
|
|
6
|
+
TRANSCRIPT_PRINT: 'transcript_print',
|
|
7
|
+
TRANSCRIPT_SEARCH: 'transcript_search',
|
|
8
|
+
TRANSCRIPT_NAVIGATE_RESULT: 'transcript_navigate_result',
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {TranscriptEvents} from './events';
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {PluginButton} from './components/plugin-button/plugin-button';
|
|
|
9
9
|
import {Transcript} from './components/transcript';
|
|
10
10
|
import {getConfigValue, isBoolean, makePlainText, prepareCuePoint} from './utils';
|
|
11
11
|
import {TranscriptConfig, PluginStates, HighlightedMap, CuePointData, ItemTypes, CuePoint} from './types';
|
|
12
|
+
import { TranscriptEvents } from "./events";
|
|
12
13
|
|
|
13
14
|
export const pluginName: string = 'playkit-js-transcript';
|
|
14
15
|
|
|
@@ -172,11 +173,12 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
172
173
|
return `${activeTextTrack?.language}-${activeTextTrack?.label}`;
|
|
173
174
|
};
|
|
174
175
|
|
|
175
|
-
private _activatePlugin = () => {
|
|
176
|
+
private _activatePlugin = (isFirstOpen = false) => {
|
|
176
177
|
this.ready.then(() => {
|
|
177
178
|
this.sidePanelsManager?.activateItem(this._transcriptPanel);
|
|
178
179
|
this._pluginState = PluginStates.OPENED;
|
|
179
180
|
this.upperBarManager?.update(this._transcriptIcon);
|
|
181
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_OPEN, {auto: isFirstOpen});
|
|
180
182
|
});
|
|
181
183
|
};
|
|
182
184
|
|
|
@@ -184,6 +186,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
184
186
|
this.ready.then(() => {
|
|
185
187
|
this.sidePanelsManager?.deactivateItem(this._transcriptPanel);
|
|
186
188
|
this.upperBarManager?.update(this._transcriptIcon);
|
|
189
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_CLOSE);
|
|
187
190
|
});
|
|
188
191
|
};
|
|
189
192
|
|
|
@@ -257,7 +260,8 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
257
260
|
onDownload={this._handleDownload}
|
|
258
261
|
printDisabled={getConfigValue(printDisabled, isBoolean, false)}
|
|
259
262
|
onPrint={this._handlePrint}
|
|
260
|
-
|
|
263
|
+
dispatcher={(eventType, payload) => this.dispatchEvent(eventType, payload)}
|
|
264
|
+
/> as any
|
|
261
265
|
);
|
|
262
266
|
},
|
|
263
267
|
presets: [ReservedPresetNames.Playback, ReservedPresetNames.Live, ReservedPresetNames.Ads],
|
|
@@ -269,8 +273,6 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
269
273
|
showTranscript: <Text id="transcript.show_plugin">Show Transcript</Text>,
|
|
270
274
|
hideTranscript: <Text id="transcript.hide_plugin">Hide Transcript</Text>
|
|
271
275
|
};
|
|
272
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
273
|
-
// @ts-ignore
|
|
274
276
|
this._transcriptIcon = this.upperBarManager!.add({
|
|
275
277
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
276
278
|
// @ts-ignore
|
|
@@ -296,7 +298,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
296
298
|
}) as number;
|
|
297
299
|
|
|
298
300
|
if ((expandOnFirstPlay && !this._pluginState) || this._pluginState === PluginStates.OPENED) {
|
|
299
|
-
this._activatePlugin();
|
|
301
|
+
this._activatePlugin(true);
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
|
|
@@ -318,6 +320,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
318
320
|
|
|
319
321
|
downloadContent(makePlainText(captions), `${language}${entryMetadata.name ? `-${entryMetadata.name}` : ''}.txt`);
|
|
320
322
|
}
|
|
323
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_DOWNLOAD, {videoPosition: this.player.currentTime});
|
|
321
324
|
};
|
|
322
325
|
|
|
323
326
|
private _handlePrint = () => {
|
|
@@ -325,6 +328,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
325
328
|
if (captions) {
|
|
326
329
|
printContent(makePlainText(captions));
|
|
327
330
|
}
|
|
331
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_PRINT, {videoPosition: this.player.currentTime});
|
|
328
332
|
};
|
|
329
333
|
|
|
330
334
|
private _handleClose = (e: OnClickEvent, byKeyboard: boolean) => {
|