How to update Kaltura player config when the playlist item is being switched?

52 views Asked by At

I tried to load playlist items by using:

kalturaPlayer.loadPlaylistByEntryList({entries: [{entryId: '123'}, {entryId: '456'}]}, {countdown: {duration: 20}});

And below is my player config

const kalturaPlayer = KalturaPlayer.setup({
      "sources": {
        "options": {},
      },
      "targetId": "player-placeholder",
      "ui": {
        "components": {},
        "settings": {
          "showSpeedMenu": true,
        }
      },
      "provider": {
        "partnerId": PARTNER_ID,
        "uiConfId": UI_CONFIG_ID,
        "ks": KS_SESSION
      },
      "playback": {
        "autoplay": true,
        "allowMutedAutoPlay": true,
        "playsinline": true,
        "textLanguage": "default",
        "pictureInPicture": false,
        "inBrowserFullscreen": false,
      },
      "plugins": {
        "share": {
          "disable": true
        },
        "download": {
          "disable": true
        },
        "report": {
          "disable": true
        }
      }
    });

If you noticed I config the player with KS in order to play the video. I used my own API to get the player KS by passing the entry_id. So when the player is being loaded, I called API to get the KS and play the video.

Since I wanted to use playlist feature, So when the entry is being switched to next or previous, I want to get the entry_id and update player config KS when the entry is being played.

kalturaPlayer.addEventListener(KalturaPlayer.playlist.PlaylistEventType.PLAYLIST_ITEM_CHANGED, () => {
   // get entry_id ? // then call my own API to get KS // then update player config with the new KS // then play the media
});

I also checked with the kaltura change-media API but I could not solve my problem.

0

There are 0 answers