shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.18k stars 1.34k forks source link

Detect when no keys are available #1771

Closed rkuroiwa closed 9 months ago

rkuroiwa commented 5 years ago

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

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

The EME spec allows a CDM to close sessions voluntarily "The CDM may close a session at any point, such as when the session is no longer needed or when system resources are lost."

When all the keys are not usable AND all the sessions are closed, the playback stops without any further action by the shaka player nor any notifications sent to the application.

What I mean by "keys are not usable" above is when MediaKeySession.keyStatuses does not list any key IDs.

Describe the solution you'd like

I kept the feature request as a detection mechanism because I'm not sure of the best way to handle this. It might make sense to emit an error/event or the shaka player should somehow handle it automatically. Or maybe it should be a configuration (e.g. register a callback, some kind of enum to configure shaka player to handle it in a certain way, etc.).

Either way, shaka player should look for the condition where 1) all keys are "not usable" and 2) all sessions are closed. Actually 2) is sufficient for 1), but the sessions reporting that no keys are usable then closing may be a different signal than just all sessions closing.

Describe alternatives you've considered

N/A. See above.

Additional context

N/A.

avelad commented 9 months ago

The correct way to implement this is with https://github.com/shaka-project/shaka-player/issues/3446 so I'm closing this issue and we'll work on the other one. Thank you so much!