SRGSSR / pillarbox-apple

A next-generation reactive media playback ecosystem for Apple platforms.
https://testflight.apple.com/join/TS6ngLqf
MIT License
43 stars 6 forks source link

Make Control Center metadata correctly display on tvOS #826

Closed defagos closed 1 month ago

defagos commented 1 month ago

As a user I want to be able to quickly see what is currently being played on tvOS, on the Apple TV device or when using a mobile device as remote.

Acceptance criteria

Tasks

defagos commented 1 month ago

A few findings:

  1. Passing a dummy player at session creation time fixes the issue, as discussed elsewhere. Even better, we can always pass a dummy player and things will work on iOS and tvOS (but maybe doing it on iOS should be avoided).
  2. The Control Center on tvOS displays previous / next track buttons but those are connected to the singleton MPRemoteCommandCenter, not to the one of the current session. This is discussed in an old WWDC 2017 session but remains true, even after the introduction of MPNowPlayingSession. This is likely an oversight. Since customization of the Control Center is limited (e.g. no +10/-10 buttons instead of skips) and since this would force us to move away from the modern MPNowPlayingSession API for an edge case (audio on tvOS), we decided to wait and fix the issue in a minimalistic way. Maybe further tvOS versions will fix API inconsistencies and make MPNowPlayingSession provide the same behaviors on tvOS as on iOS, at which point our fix should likely be dropped.

Note that Apple apps (Music, Podcasts) seem to have access to extended capabilities (like customizing Control Center buttons to have +10/-10 skips) but these capabilities seem to be private. Spotify on tvOS seem to suffer the same restriction as us who can only use AVPlayerViewController and what it provides in terms of Control Center integration on tvOS.

defagos commented 6 days ago

We still need to update the MPNowPlayingSession so that devices used as remote properly get the now playing info, even when not using the standard system UI.