From 5549b7d10465449669cb1fa9c76c4fe53ec479ae Mon Sep 17 00:00:00 2001 From: lianbenjamin <79077248+lianbenjamin@users.noreply.github.com> Date: Thu, 14 Mar 2024 12:17:41 +0200 Subject: [PATCH] feat(FEC-13492): add support for prevent seek --- src/kaltura-player.ts | 19 ++++++++++++++++++- src/types/index.ts | 1 + src/types/prevent-seek-options.ts | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/types/prevent-seek-options.ts diff --git a/src/kaltura-player.ts b/src/kaltura-player.ts index c57d2a012..3f466d9fc 100644 --- a/src/kaltura-player.ts +++ b/src/kaltura-player.ts @@ -74,7 +74,8 @@ import { SourcesConfig, KPEventTypes, HEVCConfigObject, - MediaCapabilitiesObject + MediaCapabilitiesObject, + PreventSeekOptions } from './types'; export class KalturaPlayer extends FakeEventTarget { @@ -105,6 +106,10 @@ export class KalturaPlayer extends FakeEventTarget { private _serviceProvider: ServiceProvider; private _isVisible: boolean = false; private _autoPaused: boolean = false; + private _preventSeekOptions: PreventSeekOptions = { + isActive: false, + canSeek: true + }; constructor(options: KalturaPlayerConfig) { super(); @@ -854,6 +859,10 @@ export class KalturaPlayer extends FakeEventTarget { this._reset = false; } }); + this._eventManager.listen(this, 'prevent_seek', (e: FakeEvent) => { + this._preventSeekOptions.isActive = true; + this._preventSeekOptions.canSeek = e.payload?.canSeek; + }); } private _onChangeSourceEnded(): void { @@ -1002,6 +1011,14 @@ export class KalturaPlayer extends FakeEventTarget { this._appPluginConfig = {}; } + /** + * Get prevent seek options. + * @returns {PreventSeekOptions} + */ + public get preventSeekOptions(): PreventSeekOptions { + return this._preventSeekOptions; + } + /** * Set crossOrigin attribute. * @param {?string} crossOrigin - 'anonymous', 'use-credentials' or null to remove attribute diff --git a/src/types/index.ts b/src/types/index.ts index 9efa4085c..67596a201 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -20,3 +20,4 @@ export * from './sources-config'; export * from './thumbnail-config'; export * from './ui-config'; export * from './visibility-config'; +export * from './prevent-seek-options'; diff --git a/src/types/prevent-seek-options.ts b/src/types/prevent-seek-options.ts new file mode 100644 index 000000000..f2eaeff63 --- /dev/null +++ b/src/types/prevent-seek-options.ts @@ -0,0 +1,4 @@ +export interface PreventSeekOptions { + isActive: boolean; + canSeek: boolean; +}