Skip to content

Commit

Permalink
fix(SUP-37490): Align captions with clipTo/SeekFrom Values in PlayMan…
Browse files Browse the repository at this point in the history
…ifest

### Description of the Changes

If sources.seekFrom or sources.clipTo is set
- Ignore the manifest text tracks, which will cause the playkit player
to add external text tracks according to the getPlaybackContext captions
metadata
- Pass seekFrom and clipTo to the playkit player so that it will filter
and shift the caption cues according to the new time range
  • Loading branch information
SivanA-Kaltura authored Nov 11, 2024
1 parent 723e16c commit af28f65
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/kaltura-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ export class KalturaPlayer extends FakeEventTarget {
this.reset();
this._localPlayer.loadingMedia = true;
this._uiWrapper.setLoadingSpinnerState(true);
// TODO update sources config types in provider
this.handleSourceTimeRangeUpdate((mediaOptions as any)?.seekFrom, (mediaOptions as any)?.clipTo);

try {
const providerMediaConfig: ProviderMediaConfigObject = await this._provider.getMediaConfig(mediaInfo);
const mediaConfig = Utils.Object.copyDeep(providerMediaConfig);
Expand Down Expand Up @@ -1203,4 +1206,36 @@ export class KalturaPlayer extends FakeEventTarget {
public get sessionIdCache(): SessionIdCache | null {
return this._sessionIdCache;
}

private handleSourceTimeRangeUpdate(seekFrom: number | undefined, clipTo: number | undefined): void {
let ignoreManifestTextTracks = false;

if (typeof seekFrom === 'number') {
ignoreManifestTextTracks = true;
this._localPlayer.setSeekFrom(seekFrom);
}
if (typeof clipTo === 'number') {
ignoreManifestTextTracks = true;
this._localPlayer.setClipTo(clipTo);
}
if (ignoreManifestTextTracks) {
// TODO move this into adapters
this.configure({
playback: {
options: {
html5: {
hls: {
subtitleTrackController: null
},
dash: {
manifest: {
disableText: true
}
}
}
}
}
} as any);
}
}
}

0 comments on commit af28f65

Please sign in to comment.