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

Move the processing of seekFrom and clipTo from loadMedia() into
configure(), where instead of using values from loadMedia mediaOptions
arguments, we can use the combined sources config set by merging
mediaOptions values with sources config values (which is where the
kalturaSeekFrom, kalturaClipTo values from URL are set).

Which means that:
- If the values are set ONLY by URL, we use those values to clip
captions.

- If the values are set ONLY by loadMedia, we use those values.

- If a value is set by URL and ALSO by mediaOptions, we prefer the value
set by configuration over the value set by mediaOptions (which actually
seems to be a bug because [it should be the
opposite](#880), but
this is the current behavior). So for example, kalturaSeekFrom=30 in URL
would override the seekFrom value set by loadMedia(..., { seekFrom: 10,
clipTo: 50 }).

- If one value is set by URL and one is set by mediaOptions 
(i.e. inside the page https://...?kalturaSeekFrom=20) we call
loadMedia(..., {clipTo: 60}),
we use the combined values {seekFrom: 20, clipTo: 60} together to clip
the captions.
  • Loading branch information
SivanA-Kaltura authored Nov 12, 2024
1 parent 61e2bff commit fb1522e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/kaltura-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ 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 @@ -271,6 +268,7 @@ export class KalturaPlayer extends FakeEventTarget {
delete localPlayerConfig.plugins;
if (localPlayerConfig.sources) {
const { sources } = localPlayerConfig;
this.handleSourcesTimeRangeUpdate(sources.seekFrom, sources.clipTo);
delete localPlayerConfig.sources;
this._localPlayer.configure(localPlayerConfig);
this._localPlayer.setSources(sources || {});
Expand Down Expand Up @@ -1207,7 +1205,7 @@ export class KalturaPlayer extends FakeEventTarget {
return this._sessionIdCache;
}

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

if (typeof seekFrom === 'number') {
Expand Down

0 comments on commit fb1522e

Please sign in to comment.