Skip to content

Commit

Permalink
feat(FEC-12953): Add configuration option to change the default playl…
Browse files Browse the repository at this point in the history
…ist image item duration (#607)

Currently the only way to set an image duration while playing a single media is by overriding the duration property, but this is not possible when playing playlist by entry so we need to add configuration option in loadPlaylist() public API

solves FEC-12953

related pr:
kaltura/playkit-js-image-player#10
  • Loading branch information
JonathanTGold authored Feb 19, 2023
1 parent 8422fd6 commit a561249
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion flow-typed/types/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {PlaylistItem} from '../../src/common/playlist/playlist-item';
*/
type _KPPlaylistOptions = {
autoContinue: boolean,
loop: boolean
loop: boolean,
imageDuration: number
};
declare type KPPlaylistOptions = _KPPlaylistOptions;

Expand Down
6 changes: 2 additions & 4 deletions src/common/playlist/playlist-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {Playlist} from './playlist';
import {PlaylistItem} from './playlist-item';
import {mergeProviderPluginsConfig} from '../utils/setup-helpers';

const DEFAULT_IMAGE_DURATION = 5;

/**
* @class PlaylistManager
* @param {KalturaPlayer} player - The player instance
Expand All @@ -28,7 +26,7 @@ class PlaylistManager {
this._player = player;
this._eventManager = new EventManager();
this._playlist = new Playlist();
this._options = {autoContinue: true, loop: false};
this._options = {autoContinue: true, loop: false, imageDuration: 5};
this._countdown = {duration: 10, showing: true};
this._mediaInfoList = [];
this._playerOptions = options;
Expand Down Expand Up @@ -269,7 +267,7 @@ class PlaylistManager {

_onChangeSourceStarted(): void {
if (this._playlist.items[this._playlist._activeItemIndex].sources?.type === 'Image') {
this._player.configure({sources: {duration: DEFAULT_IMAGE_DURATION}});
this._player.configure({sources: {duration: this._options.imageDuration}});
}
}

Expand Down

0 comments on commit a561249

Please sign in to comment.