Issue with loading next video when using ClearKey

Hey!

I recently started trialing with playback using ClearKey instead of Widevine.

I have basically two functions in my code.

First one is PlayVideo function, which fetches the video data from the API which returns the needed data for playlist.

My playlist is built as following;

{
  "dash": "videourl.mpd",
  "description": "desc",
  "drm": {
    "clearkey": [{
      "key":"valid-key",
      "kid":"valid-kid"
    }]
  },
  "title":"title-of-video"
}

And once I have that playlist string, I use player.load(playlist) which starts the playback of the video normally with no issues.

But then I have function PlayNextVideo(), which again recalls my API, fetches the ID of the next video, and then with that ID calls the PlayVideo function again. And here is where the issue comes up, when the player.load(playlist) is called 2nd time on the same page, it loads the video source, title, description, everything properly to the player element on the page, but the video doesn’t get decrypted despite including the correct set of ClearKeys on the playlist.

I’m 99% sure the issue is lying somewhere in the ClearKey feature, because everything else loads properly on the player, expect it doesn’t just get decrypted.

So my question is that is there any function / API which I could use to a) verify which ClearKeys are currently active on the player b) to possibly forcefully to wipe off the old ClearKeys from the player before loading the new source.

Before shifting to use of ClearKey, I used Widevine DRM with the same playlist format and exactly same functions and it worked wonderfully with no issues on loading follow up videos.
This issue only started when I shifted from Widevine to ClearKey, and only thing separating those is the use of ClearKey instead of Widevine DRM.

Right now my hotfix to this issue has been destroying the player when calling PlayNextVideo and then creating new player, but naturally that isn’t the most optimal solution.

Hey @MSU,

Welcome to the Bitmovin Community!

I quickly tried to re-create this problem and can’t see the same for some reason, it works as expected for me. Could you please help me reproduce this problem? It sounds like a bug if the player uses old keys instead of the new ones.

Which Bitmovin Player version are you using (I was using the latest - 8.152.0)?
Can you share a sample page with your setup where also your streams are used? Or provide me otherwise access to at least two of your ClearKey streams with the required source configuration (i.e. DASH manifest URL and ClearKey Key/KID)?

I understand that you might not want to share this publicly, so please feel free to send me a direct message with these details.

Thanks,
Daniel

Hey @MSU,

Thanks for your patience. I can confirm that there seems to be an issue in this scenario. However, you can work around that problem by re-creating the player when loading a new source.

So instead of

player.load(source2)

you could do

player.destroy().then(() => {
  player = new bitmovin.player.Player(container, playerConfig);
  player.load(source2);
});

I’ve successfully tested playback with this approach.

Hope this helps.

Best,
Daniel