From 801e88f140c129e54a4a6689acee426936e43e06 Mon Sep 17 00:00:00 2001 From: SivanA-Kaltura <88330203+SivanA-Kaltura@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:12:02 +0200 Subject: [PATCH 1/4] add clip captions --- src/kaltura-player.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/kaltura-player.ts b/src/kaltura-player.ts index 6fb174e53..f3581493f 100644 --- a/src/kaltura-player.ts +++ b/src/kaltura-player.ts @@ -162,6 +162,38 @@ export class KalturaPlayer extends FakeEventTarget { this.reset(); this._localPlayer.loadingMedia = true; this._uiWrapper.setLoadingSpinnerState(true); + + let seekFrom, clipTo; + + if (!isNaN(mediaOptions?.seekFrom)) { + seekFrom = mediaOptions.seekFrom; + this._localPlayer.setCuesTimeRangeStart(seekFrom); + } + if (!isNaN(mediaOptions?.clipTo)) { + clipTo = mediaOptions.clipTo; + this._localPlayer.setCuesTimeRangeEnd(clipTo); + } + + if (seekFrom !== undefined || clipTo !== undefined) { + // TODO move this into adapters + this.configure({ + playback: { + options: { + html5: { + hls: { + subtitleTrackController: null + }, + dash: { + manifest: { + disableText: true + } + } + } + } + } + } as any); + } + try { const providerMediaConfig: ProviderMediaConfigObject = await this._provider.getMediaConfig(mediaInfo); const mediaConfig = Utils.Object.copyDeep(providerMediaConfig); From ab65cb33e4456bc78b832a0146e5c086a4d79b41 Mon Sep 17 00:00:00 2001 From: SivanA-Kaltura <88330203+SivanA-Kaltura@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:46:40 +0200 Subject: [PATCH 2/4] split code into separate function + fix some lint errors --- src/kaltura-player.ts | 65 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/src/kaltura-player.ts b/src/kaltura-player.ts index f3581493f..166f392cf 100644 --- a/src/kaltura-player.ts +++ b/src/kaltura-player.ts @@ -162,37 +162,8 @@ export class KalturaPlayer extends FakeEventTarget { this.reset(); this._localPlayer.loadingMedia = true; this._uiWrapper.setLoadingSpinnerState(true); - - let seekFrom, clipTo; - - if (!isNaN(mediaOptions?.seekFrom)) { - seekFrom = mediaOptions.seekFrom; - this._localPlayer.setCuesTimeRangeStart(seekFrom); - } - if (!isNaN(mediaOptions?.clipTo)) { - clipTo = mediaOptions.clipTo; - this._localPlayer.setCuesTimeRangeEnd(clipTo); - } - - if (seekFrom !== undefined || clipTo !== undefined) { - // TODO move this into adapters - this.configure({ - playback: { - options: { - html5: { - hls: { - subtitleTrackController: null - }, - dash: { - manifest: { - disableText: true - } - } - } - } - } - } as any); - } + // 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); @@ -1235,4 +1206,36 @@ export class KalturaPlayer extends FakeEventTarget { public get sessionIdCache(): SessionIdCache | null { return this._sessionIdCache; } + + private handleSourceTimeRangeUpdate(seekFrom: number | undefined, clipTo: number | undefined) { + let ignoreManifestTextTracks = false; + + if (typeof seekFrom === 'number') { + ignoreManifestTextTracks = true; + this._localPlayer.setCuesTimeRangeStart(seekFrom); + } + if (typeof clipTo === 'number') { + ignoreManifestTextTracks = true; + this._localPlayer.setCuesTimeRangeEnd(clipTo); + } + if (ignoreManifestTextTracks) { + // TODO move this into adapters + this.configure({ + playback: { + options: { + html5: { + hls: { + subtitleTrackController: null + }, + dash: { + manifest: { + disableText: true + } + } + } + } + } + } as any); + } + } } From 11ab94f6ca19b49152fe9a6c46c170200b962e77 Mon Sep 17 00:00:00 2001 From: SivanA-Kaltura <88330203+SivanA-Kaltura@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:02:25 +0200 Subject: [PATCH 3/4] update api call --- src/kaltura-player.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaltura-player.ts b/src/kaltura-player.ts index 166f392cf..44540c575 100644 --- a/src/kaltura-player.ts +++ b/src/kaltura-player.ts @@ -1212,11 +1212,11 @@ export class KalturaPlayer extends FakeEventTarget { if (typeof seekFrom === 'number') { ignoreManifestTextTracks = true; - this._localPlayer.setCuesTimeRangeStart(seekFrom); + this._localPlayer.setSeekFrom(seekFrom); } if (typeof clipTo === 'number') { ignoreManifestTextTracks = true; - this._localPlayer.setCuesTimeRangeEnd(clipTo); + this._localPlayer.setClipTo(clipTo); } if (ignoreManifestTextTracks) { // TODO move this into adapters From 60f0be9297836bc04010a41dbff2718334ea52d7 Mon Sep 17 00:00:00 2001 From: SivanA-Kaltura <88330203+SivanA-Kaltura@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:10:29 +0200 Subject: [PATCH 4/4] fix warning --- src/kaltura-player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaltura-player.ts b/src/kaltura-player.ts index 44540c575..0bc083456 100644 --- a/src/kaltura-player.ts +++ b/src/kaltura-player.ts @@ -1207,7 +1207,7 @@ export class KalturaPlayer extends FakeEventTarget { return this._sessionIdCache; } - private handleSourceTimeRangeUpdate(seekFrom: number | undefined, clipTo: number | undefined) { + private handleSourceTimeRangeUpdate(seekFrom: number | undefined, clipTo: number | undefined): void { let ignoreManifestTextTracks = false; if (typeof seekFrom === 'number') {