shaka-player icon indicating copy to clipboard operation
shaka-player copied to clipboard

Add Player.retryLicensing()

Open rkuroiwa opened this issue 7 years ago • 6 comments

Have you read the FAQ and checked for duplicate open issues? Yes.

Is your feature request related to a problem? Please describe.

This is a follow up on https://github.com/google/shaka-player/issues/1771 If shaka player signaled the app that there are no keys available, then the app can decide to take an action.

Describe the solution you'd like

Player.retryRequest() will restart from creating a new MediaKeySession, from the same MediaKeys instance that is attached to the media element, and generates a request (MediaKeySession.generateRequest()). For "persistent-license" sessions, use MediaKeySession.load() instead.

Basically it restarts from loading a license into the CDM.

Describe alternatives you've considered

If it is going to be a configuration rather than an notification to the app, this doesn't need to be exposed, but the functionality is still required.

Additional context

This may be also useful for other cases. For example, if the user decides to put their computer to sleep for the duration of the license, and when they wake up the computer, all the keys are "expired". The app may decide to call Player.retryRequest() to "renew" the license.

rkuroiwa avatar Jan 18 '19 00:01 rkuroiwa

I would suggest a different name: player.retryLicensing(). Retrying a "request" is very generic, and the name could apply to all kinds of network requests. Since we want something that parallels player.retryStreaming(), but for DRM licenses, I think retryLicensing() is the better name.

I'll rename the issue to reflect that.

joeyparrish avatar Jan 18 '19 19:01 joeyparrish

This looks like a nice feature. On our side, we are facing an issue on Tizen devices when the user leaves the app with the player opened. When he comes back after some minutes, we ran into an error because the player tries to resume playback but as the license expired and it was not renewed since the app was in the background, Shaka just crash.

Even better, is it possible Shaka automatically tries to renew the license when it was not able to renew because the app is in the background?

cristian-atehortua avatar Aug 16 '22 22:08 cristian-atehortua