Skip to content

fix: Properly setup DRM to support Airplay#1245

Merged
spuppo-mux merged 8 commits intomuxinc:mainfrom
spuppo-mux:fix/drm_issues_over_airplay
Dec 3, 2025
Merged

fix: Properly setup DRM to support Airplay#1245
spuppo-mux merged 8 commits intomuxinc:mainfrom
spuppo-mux:fix/drm_issues_over_airplay

Conversation

@spuppo-mux
Copy link
Contributor

@spuppo-mux spuppo-mux commented Nov 25, 2025

Closes #183

I also reorganized the onFpEncrypted callback to get a better understanding of the code and compare it with the FairPlay Streaming Overview.

The main issue here was that we were ignoring the Apple TV SPC when generating the DRM license. This is reflected on the session.addEventListener('message', ...) changes. We were listening just once to this message, but more recent versions of Apple TV send new messages when using AirPlay. Therefore I modified that listener to ask for that license again and update the session for each new message.

Note for reviewers: Please pay extra attention to the way I reformatted this code (not sure if I should change some Promise.reject), the new error messages and/or if I should be removing the event listener at some point.

@spuppo-mux spuppo-mux requested a review from a team as a code owner November 25, 2025 20:52
@vercel
Copy link

vercel bot commented Nov 25, 2025

@spuppo-mux is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

@snyk-io
Copy link

snyk-io bot commented Nov 25, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
elements-demo-astro Ready Ready Preview Comment Dec 3, 2025 9:11pm
elements-demo-nextjs Ready Ready Preview Comment Dec 3, 2025 9:11pm
elements-demo-svelte-kit Ready Ready Preview Comment Dec 3, 2025 9:11pm
elements-demo-vanilla Ready Ready Preview Comment Dec 3, 2025 9:11pm
elements-demo-vue Ready Ready Preview Comment Dec 3, 2025 9:11pm

@luwes luwes requested a review from Copilot December 2, 2025 19:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes DRM support for AirPlay by properly handling multiple license requests from Apple TV. The main issue was that the code only listened once to the 'message' event, but newer Apple TV versions send multiple messages when using AirPlay.

Key Changes:

  • Refactored the FairPlay encryption handler into smaller, more maintainable functions
  • Changed the 'message' event listener from { once: true } to persistent to handle multiple AirPlay license requests
  • Updated error handling to use saveAndDispatchError consistently instead of Promise.reject

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…changed saveAndDispatchError to Promise.reject to propagate failure; added teardown function to remove listeners and close session.
@spuppo-mux spuppo-mux requested a review from luwes December 3, 2025 15:19
return;
}

console.error(errOrResp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@luwes luwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@spuppo-mux spuppo-mux merged commit 673b7ff into muxinc:main Dec 3, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Dec 3, 2025
luwes pushed a commit that referenced this pull request Dec 4, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>@mux/mux-audio: 0.15.17</summary>

##
[0.15.17](https://github.com/muxinc/elements/compare/@mux/mux-audio@0.15.16...@mux/mux-audio@0.15.17)
(2025-12-04)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/mux-audio-react: 0.15.17</summary>

##
[0.15.17](https://github.com/muxinc/elements/compare/@mux/mux-audio-react@0.15.16...@mux/mux-audio-react@0.15.17)
(2025-12-04)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/playback-core: 0.32.0</summary>

##
[0.32.0](https://github.com/muxinc/elements/compare/@mux/playback-core@0.31.4...@mux/playback-core@0.32.0)
(2025-12-04)


### Features

* add `max-auto-resolution` attribute for automatic resolution capping
([#1243](#1243))
([a43edd5](a43edd5))


### Bug Fixes

* Properly setup DRM to support Airplay
([#1245](#1245))
([673b7ff](673b7ff))
</details>

<details><summary>@mux/mux-player: 3.10.0</summary>

##
[3.10.0](https://github.com/muxinc/elements/compare/@mux/mux-player@3.9.2...@mux/mux-player@3.10.0)
(2025-12-04)


### Features

* add `max-auto-resolution` attribute for automatic resolution capping
([#1243](#1243))
([a43edd5](a43edd5))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-video bumped from 0.28.2 to 0.29.0
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/mux-player-astro: 3.10.0</summary>

##
[3.10.0](https://github.com/muxinc/elements/compare/@mux/mux-player-astro@3.9.2...@mux/mux-player-astro@3.10.0)
(2025-12-04)


### Miscellaneous Chores

* **@mux/mux-player-astro:** Synchronize player versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-player bumped from 3.9.2 to 3.10.0
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/mux-player-react: 3.10.0</summary>

##
[3.10.0](https://github.com/muxinc/elements/compare/@mux/mux-player-react@3.9.2...@mux/mux-player-react@3.10.0)
(2025-12-04)


### Features

* add `max-auto-resolution` attribute for automatic resolution capping
([#1243](#1243))
([a43edd5](a43edd5))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-player bumped from 3.9.2 to 3.10.0
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/mux-video: 0.29.0</summary>

##
[0.29.0](https://github.com/muxinc/elements/compare/@mux/mux-video@0.28.2...@mux/mux-video@0.29.0)
(2025-12-04)


### Features

* add `max-auto-resolution` attribute for automatic resolution capping
([#1243](#1243))
([a43edd5](a43edd5))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/mux-video-react: 0.29.0</summary>

##
[0.29.0](https://github.com/muxinc/elements/compare/@mux/mux-video-react@0.28.2...@mux/mux-video-react@0.29.0)
(2025-12-04)


### Miscellaneous Chores

* **@mux/mux-video-react:** Synchronize video versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.31.4 to 0.32.0
</details>

<details><summary>@mux/mux-uploader: 1.4.1</summary>

##
[1.4.1](https://github.com/muxinc/elements/compare/@mux/mux-uploader@1.4.0...@mux/mux-uploader@1.4.1)
(2025-12-04)


### Bug Fixes

* button text for file-select slot can now be customized
([#1252](#1252))
([240d2ae](240d2ae))
</details>

<details><summary>@mux/mux-uploader-astro: 1.4.1</summary>

##
[1.4.1](https://github.com/muxinc/elements/compare/@mux/mux-uploader-astro@1.4.0...@mux/mux-uploader-astro@1.4.1)
(2025-12-04)


### Miscellaneous Chores

* **@mux/mux-uploader-astro:** Synchronize uploader versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-uploader bumped from 1.4.0 to 1.4.1
</details>

<details><summary>@mux/mux-uploader-react: 1.4.1</summary>

##
[1.4.1](https://github.com/muxinc/elements/compare/@mux/mux-uploader-react@1.4.0...@mux/mux-uploader-react@1.4.1)
(2025-12-04)


### Miscellaneous Chores

* **@mux/mux-uploader-react:** Synchronize uploader versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-uploader bumped from 1.4.0 to 1.4.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants