androidx / androidx/media

Support Multi-Key Content with Key Rotation While Ensuring Seamless Track Switching

Open
#2,271 9 comments 0 reactions 1 assignee View on GitHub

@icbaker is already working on this.

Since Apr 2, 2025.

needs triage question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

I apologize if this question has been asked before. I searched for similar issues but couldn’t find an exact answer or may not have fully understood previous discussions.

I am trying to support multi-key HLS linear content with key rotation while ensuring seamless track switching.
As per the, Digital rights management - Key rotation

To play streams with rotating keys, pass true to MediaItem.DrmConfiguration.Builder.setMultiSession when building the media item.

I enabled DRM MultiSession mode to support key rotation, with my license server configured according to Case 2: License server responds with requested key only. However, because ExoPlayer only requests a license for the key associated with the currently selected track, I observed that playback freezes or experiences rebuffering during track switching while fetching the key for the selected track.

To avoid this issue, I reconfigured my license server following Case 1: License server responds with all keys for the content. While this prevents freezing during track switching, key rotation no longer works since all keys are provided upfront.

I have a few ideas to customize ExoPlayer to handle both scenarios, but before implementing any workarounds, I wanted to check if there is an official simple solution for this use case.

Any guidance would be greatly appreciated. Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.