Chromecast Shaka player duplicate licences

211 Views Asked by At

Our license server enables the JWT JTI key for anti-replays, on our chomecast we see the device is requesting the license more than twice ( if it was twice I could look at maybe the first request is for the server certificate - but for chromecast this is not a thing it seems) which triggers the JTI anti replay. I see that the current version of the cast firmware uses shaka 3.2.0 and that there was a fix for this issue for Widevine ( or similar ) done for 3.0.2.

Wondering if someone as solved a similar issue on a chromecast where the player is requesting the license more than once ?

thanks

Expect the chromecast player to request license once.

2

There are 2 best solutions below

0
On

Unless the license is cached (persisted) in the app, Widevine makes two separate requests for every asset:

  1. Service certificate request
  2. License request

On first inspection they appear very similar, and might lead you to believe they are duplicates, but if you look at the payload, service certificate requests are smaller in size (~2 bytes) compared to license requests.

How to preload Widevine service certificates in Shakaplayer: https://github.com/shaka-project/shaka-player/blob/6513ac056e5fd3ee9aecbb234c724119b058ef8d/docs/tutorials/widevine-service-certs.md

0
On

If you want to prevent the Shaka player Chromecast plugin from requesting the Widevine license more than once, you can use persistent license request. This means that the plugin requests the license once and reuses it for the duration of the playback. To enable persistent license requests, you can set the "persistentStateRequired" property to true in the player configuration.

Something like this

// Configure the Shaka player
const player = new shaka.cast.CastReceiver(playerManager, YOUR_APP_ID);
player.configure({
  manifest: YOUR_MANIFEST_URL,
  streaming: {
    rebufferingGoal: 2,
    bufferingGoal: 5,
    bufferBehind: 30,
  },
  // Set persistentStateRequired to true to enable persistent license requests
  persistentStateRequired: true
});

The persistentStateRequired property can be set to true in the player.configure() method to enable persistent license requests. This tells the plugin to request the Widevine license once and reuse it for the duration of the playback.

Refer to the documentation https://shaka-player-demo.appspot.com/docs/api/shaka.extern.html#.PlayerConfiguration

and this in particular

AdvancedDrmConfiguration

persistentStateRequired boolean Defaults to false. True if the application requires the key system to support persistent state, e.g., for persistent license storage.

Search for persistentState in the code https://shaka-player-demo.appspot.com/docs/api/externs_shaka_player.js.html