Skip to content

Commit

Permalink
feat(FEC-13492): add support for prevent seek
Browse files Browse the repository at this point in the history
  • Loading branch information
lianbenjamin committed Mar 14, 2024
1 parent db77882 commit 5549b7d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/kaltura-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ import {
SourcesConfig,
KPEventTypes,
HEVCConfigObject,
MediaCapabilitiesObject
MediaCapabilitiesObject,
PreventSeekOptions
} from './types';

export class KalturaPlayer extends FakeEventTarget {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
4 changes: 4 additions & 0 deletions src/types/prevent-seek-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface PreventSeekOptions {
isActive: boolean;
canSeek: boolean;
}

0 comments on commit 5549b7d

Please sign in to comment.