From ff40c3fdf2b64cba4ab491a1f8b7be86085653a4 Mon Sep 17 00:00:00 2001 From: JonathanTGold <62672270+JonathanTGold@users.noreply.github.com> Date: Tue, 9 Nov 2021 17:33:48 +0200 Subject: [PATCH] fix(FEC-11611): Pass the program ID when sending a bookmark (#615) Description of the Changes add setSourcesMetadata api (to enable dynamically cofigure the epgId (programId) in the sources.metadata) related pr: kaltura/playkit-js-providers#155 kaltura/playkit-js-ott-analytics#64 kaltura/kaltura-player-js#504 kaltura/kaltura-player-js#503 --- flow-typed/types/metadata-config.js | 7 ++++++- src/player.js | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/flow-typed/types/metadata-config.js b/flow-typed/types/metadata-config.js index d2f2964bb..a86bbde05 100644 --- a/flow-typed/types/metadata-config.js +++ b/flow-typed/types/metadata-config.js @@ -1,5 +1,10 @@ // @flow declare type PKMetadataConfigObject = { name?: string, - description?: string + description?: string, + mediaType?: string, + metas?: Object, + tags?: Object, + epgId?: string, + recordingId?: string }; diff --git a/src/player.js b/src/player.js index 57836cf27..f2d305fe3 100644 --- a/src/player.js +++ b/src/player.js @@ -465,6 +465,20 @@ export default class Player extends FakeEventTarget { this._applyABRRestriction(config); } + /** + * Configures the player metadata according to a given configuration. + * @param {PKMetadataConfigObject} sourcesMetadata - The sources metadata for the player instance. + * @returns {void} + */ + setSourcesMetadata(sourcesMetadata: PKMetadataConfigObject): void { + if (this._sources) { + if (!this._sources.metadata) { + this._sources.metadata = {}; + } + Utils.Object.mergeDeep(this._sources.metadata, sourcesMetadata); + } + } + /** * Configures the player according to a given configuration. * @param {PKSourcesConfigObject} sources - The sources for the player instance.