mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-14 15:56:38 +03:00
d98169bc25
So basically, when a license request fails (eg. network Error, server down whatever), apps can now retry from scratch by calling `player.retryLicensing()`. This was tricky to implement because of EME spec limitations: `generateRequest()` can only be called once per session. So if it fails, it would be stuck. So I close the old session and create a brand new one with the same `initData` > Will Video element throw an error during this process? we were worried that closing the session would leave the video without keys for a brief moment, potentially triggering errors. But in practice, the transition is fast enough( I added a 0.1s delay for CDM clean up) and the video element handles it gracefully > Will new encrypted event fire? If not, will it limit this feature? The encrypted event only fires when the browser first encounters encrypted content. When we close and recreate a session, the content is already loaded, so no new event Solutions: In `CreateSession()` metadata store `initData` and `initDataType` in the session metadata when the session is first created. So when `retryLicensing()`is called, we just grab the stored data and pass it to `generateRequest()` on the new session. No need to wait for an `encrypted` event at all. --------- Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com> Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>