@playkit-js/transcript 3.5.33 → 3.5.34

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/transcript",
3
- "version": "3.5.33",
3
+ "version": "3.5.34",
4
4
  "main": "dist/playkit-transcript.js",
5
5
  "license": "AGPL-3.0",
6
6
  "private": false,
@@ -6,6 +6,8 @@ import * as styles from './caption.scss';
6
6
 
7
7
  import {TranscriptEvents} from '../../events/events';
8
8
 
9
+ //@ts-ignore
10
+ const {getDurationAsText} = KalturaPlayer.ui.utils
9
11
  const {withText, Text} = KalturaPlayer.ui.preacti18n;
10
12
  const {withEventManager} = KalturaPlayer.ui.Event;
11
13
  const {withPlayer} = KalturaPlayer.ui.components;
@@ -20,7 +22,8 @@ export interface CaptionProps {
20
22
  player?: any;
21
23
  captionLabel?: string;
22
24
  moveToSearch?: string;
23
- navigationInstruction?: string
25
+ navigationInstruction?: string;
26
+ timeLabel?: string;
24
27
  setTextToRead: (textToRead: string, delay?: number) => void;
25
28
  }
26
29
 
@@ -39,7 +42,9 @@ interface ExtendedCaptionProps extends CaptionProps {
39
42
  const translates = {
40
43
  captionLabel: <Text id="transcript.caption_label">Jump to this point in video</Text>,
41
44
  moveToSearch: <Text id="transcript.move_to_search">Click to jump to search result</Text>,
42
- navigationInstruction: <Text id="transcript.navigation_instruction">Press Home to navigate to the beginning of the transcript. Press End to jump to the end of the transcript.</Text>
45
+ navigationInstruction: <Text id="transcript.navigation_instruction">Press Home to navigate to the beginning of the transcript. Press End to jump to the end of the transcript.</Text>,
46
+ timeLabel: <Text id="transcript.time_label">Timestamp</Text>,
47
+
43
48
  };
44
49
 
45
50
  @withText(translates)
@@ -145,7 +150,7 @@ export class Caption extends Component<ExtendedCaptionProps> {
145
150
  };
146
151
 
147
152
  render() {
148
- const {caption, highlighted, showTime, longerThanHour, indexMap, captionLabel, moveToSearch, navigationInstruction} = this.props;
153
+ const {caption, highlighted, showTime, longerThanHour, indexMap, captionLabel, moveToSearch, navigationInstruction, timeLabel, player} = this.props;
149
154
  const {startTime, id} = caption;
150
155
  const isHighlighted = Object.keys(highlighted).some(c => c === id);
151
156
  const time = showTime ? secondsToTime(startTime, longerThanHour) : '';
@@ -153,7 +158,7 @@ export class Caption extends Component<ExtendedCaptionProps> {
153
158
  const captionA11yProps: Record<string, any> = {
154
159
  ariaCurrent: isHighlighted,
155
160
  tabIndex: 0,
156
- ariaLabel: `${time}${showTime ? ' ' : ''}${caption.text} ${indexMap ? moveToSearch : captionLabel}. ${navigationInstruction}`,
161
+ ariaLabel: `${showTime? `${timeLabel} ${getDurationAsText(Math.floor(startTime), player?.config.ui.locale, true)} ` : ''}${caption.text} ${indexMap ? moveToSearch : captionLabel}. ${navigationInstruction}`,
157
162
  role: 'button'
158
163
  };
159
164
 
@@ -26,7 +26,8 @@
26
26
  "move_to_search": "Click to jump to search result",
27
27
  "to_search_result": "Go to result",
28
28
  "to_search_result_label": "Click to jump to this point in the video",
29
- "navigation_instruction": "Press Home to navigate to the beginning of the transcript. Press End to jump to the end of the transcript."
29
+ "navigation_instruction": "Press Home to navigate to the beginning of the transcript. Press End to jump to the end of the transcript.",
30
+ "time_label": "Timestamp"
30
31
  }
31
32
  }
32
33
  }