Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiperiod: Optimize transition from unencrypted to encrypted period #4396

Open
dsilhavy opened this issue Feb 28, 2024 · 0 comments
Open
Assignees
Milestone

Comments

@dsilhavy
Copy link
Collaborator

Description

In a multiperiod MPD some periods might be encrypted while other periods are not. An example of that is ad-insertion, in which the ad periods are typically not encrypted but the main content periods are.

For some DRM systems, it is necessary to initialize the MSE with an encrypted init segment to allow a smooth transition between unencrypted and encrypted periods. If the media player starts with an unencrypted period and then transitions to an encrypted period, the MSE will throw an error unless it has been initialized with an encrypted init segment first.

Our current implementation overcomes this limitation by resetting the MSE once and only in this scenario:

  1. Playback is started with an unencrypted period
  2. Player needs to transition to an encrypted period
  3. MSE is reset prior to this transition.

Suggested implementation

To improve the scenario described above and avoid an MSE reset, we can synthesize an encrypted init segment directly in the player. The synthesized encrypted init segment has a static KID which we ignore in the resulting encrypted events thrown by the EME.

After appending this synthesized encrypted init segment we immediately append the "normal" unencrypted init segment of the first playback period and follow the default workflow.

Open questions

  • Should we scan the MPD for encrypted periods before applying this workaround? Or should we always apply this workaround (configurable via settings parameter) as there might be periods with encrypted content coming up which are not yet signaled in the MPD.
  • As an alternative, if we scan the MPD for encrypted periods we can also download an init segment from one of the upcoming encrypted periods. However, this requires us to initialize the period in dash.js internally which would require major rewriting of the existing logic. We would also need to be more dynamic when it comes to ignoring encrypted events thrown by the EME.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Selected for Development
Development

No branches or pull requests

1 participant