@playkit-js/transcript 3.5.21 → 3.5.22-canary.0-d2a2936

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.21",
3
+ "version": "3.5.22-canary.0-d2a2936",
4
4
  "main": "dist/playkit-transcript.js",
5
5
  "license": "AGPL-3.0",
6
6
  "private": false,
@@ -85,7 +85,7 @@
85
85
  "name": "playkit-js-transcript",
86
86
  "dependencies": {
87
87
  "playkit-kaltura-cuepoints": "3.0.13",
88
- "playkit-ui-managers": "1.5.4"
88
+ "playkit-ui-managers": "1.5.5"
89
89
  }
90
90
  }
91
91
  }
@@ -44,6 +44,10 @@
44
44
  font-family: sans-serif;
45
45
  font-style: normal;
46
46
  }
47
+
48
+ *:focus-visible:not(input) {
49
+ outline: 1px solid $tab-focus-color;
50
+ }
47
51
  }
48
52
 
49
53
  .global-container {
@@ -113,6 +113,8 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
113
113
  private _bottomAutoscrollEdge: number = 0;
114
114
  private _thirdOfWidgetHeight: number = 0;
115
115
 
116
+ private _resizeObserver: ResizeObserver | null = null;
117
+
116
118
  state: TranscriptState = {
117
119
  isAutoScrollEnabled: true,
118
120
  widgetWidth: 0,
@@ -120,7 +122,16 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
120
122
  };
121
123
 
122
124
  componentDidMount(): void {
123
- this._setWidgetSize();
125
+ if (window.ResizeObserver) {
126
+ // observe transcript root element size changes
127
+ this._resizeObserver = new ResizeObserver(() => {
128
+ this._setWidgetSize();
129
+ });
130
+ this._resizeObserver.observe(this._widgetRootRef!);
131
+ } else {
132
+ // use player size to define transcript root element size
133
+ this._setWidgetSize();
134
+ }
124
135
  }
125
136
 
126
137
  componentDidUpdate(previousProps: Readonly<TranscriptProps>, previousState: Readonly<TranscriptState>): void {
@@ -136,12 +147,19 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
136
147
  this._debounced.findSearchMatches();
137
148
  }
138
149
 
139
- if (previousProps.playerWidth !== playerWidth) {
150
+ if (!this._resizeObserver && previousProps.playerWidth !== playerWidth) {
140
151
  // re-calculate wiget size if player size changed
141
152
  this._setWidgetSize();
142
153
  }
143
154
  }
144
155
 
156
+ componentWillUnmount(): void {
157
+ if (this._resizeObserver) {
158
+ this._resizeObserver?.disconnect();
159
+ this._resizeObserver = null;
160
+ }
161
+ }
162
+
145
163
  private _enableAutoScroll = (event: OnClickEvent, byKeyboard?: boolean) => {
146
164
  event.preventDefault();
147
165
  if (this.state.isAutoScrollEnabled) {
@@ -181,7 +181,8 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
181
181
  };
182
182
 
183
183
  private _makeCaptionKey = (language?: string, label?: string): string => {
184
- return `${language}-${label}`;
184
+ // use 'default' language as fallback when language argument is undefined or empty string
185
+ return `${language || 'default'}-${label}`;
185
186
  };
186
187
 
187
188
  private _activatePlugin = (isFirstOpen = false) => {
@@ -229,6 +230,9 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
229
230
  };
230
231
 
231
232
  private _handleDetach = () => {
233
+ if (this._isDetached()) {
234
+ this._handleAttach(CloseDetachTypes.bringBack);
235
+ }
232
236
  this.sidePanelsManager?.detachItem(this._transcriptPanel, {
233
237
  width: 600,
234
238
  height: 600,
@@ -315,7 +319,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
315
319
  />
316
320
  ) as any;
317
321
  },
318
- presets: [ReservedPresetNames.Playback, ReservedPresetNames.Live, ReservedPresetNames.Ads],
322
+ presets: [ReservedPresetNames.Playback, ReservedPresetNames.Live, ReservedPresetNames.Ads, 'MiniAudioUI'],
319
323
  position: position,
320
324
  expandMode: expandMode === SidePanelModes.ALONGSIDE ? SidePanelModes.ALONGSIDE : SidePanelModes.OVER
321
325
  }) as number;
@@ -389,6 +393,10 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
389
393
  this._pluginState = PluginStates.CLOSED;
390
394
  };
391
395
 
396
+ public isPluginAvailable = () => {
397
+ return this._captionMap.size > 0;
398
+ };
399
+
392
400
  static isValid(): boolean {
393
401
  return true;
394
402
  }