@playkit-js/transcript 3.5.15 → 3.5.16

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.15",
3
+ "version": "3.5.16",
4
4
  "main": "dist/playkit-transcript.js",
5
5
  "license": "AGPL-3.0",
6
6
  "private": false,
@@ -56,6 +56,7 @@ export interface TranscriptProps {
56
56
  smallScreen?: boolean;
57
57
  expandMode?: string;
58
58
  dispatcher: (name: string, payload?: any) => void;
59
+ activeCaptionLanguage: string;
59
60
  }
60
61
 
61
62
  interface TranscriptState {
@@ -107,13 +108,15 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
107
108
  };
108
109
 
109
110
  componentDidUpdate(previousProps: Readonly<TranscriptProps>, previousState: Readonly<TranscriptState>): void {
110
- const {captions} = this.props;
111
+ const {captions, activeCaptionLanguage} = this.props;
111
112
  const {search} = this.state;
112
113
  if (previousProps.captions !== captions) {
113
- this.setState({search: '', isAutoScrollEnabled: true});
114
+ // clear search value only if active caption language was switched, otherwise keep previous value
115
+ this.setState({search: previousProps.activeCaptionLanguage !== activeCaptionLanguage ? '' : previousState.search, isAutoScrollEnabled: true});
114
116
  }
115
117
 
116
- if (previousState.search !== search) {
118
+ if (previousState.search !== search || (previousProps.captions !== captions && previousProps.activeCaptionLanguage === activeCaptionLanguage)) {
119
+ // trigger search in case search value has changed, or new captions were added for the same language (preventSeek use-case)
117
120
  this._debounced.findSearchMatches();
118
121
  }
119
122
 
@@ -271,6 +271,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
271
271
  printDisabled={getConfigValue(printDisabled, isBoolean, false)}
272
272
  onPrint={this._handlePrint}
273
273
  dispatcher={(eventType, payload) => this.dispatchEvent(eventType, payload)}
274
+ activeCaptionLanguage={this._activeCaptionMapId}
274
275
  /> as any
275
276
  );
276
277
  },