~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/hydraulophone

An unofficial YouTube Music app for iPhone, iPad, and Mac.

0
0
main
75 lines · 4.7 KB Raw History

Native media integration

Updated 2026-09-23. This is a Hydraulophone platform integration decision; it changes no InnerTube request or stream-selection behavior.

PlaybackController owns system transport intents and publishes title, artist, album, elapsed time, duration, and artwork through the operating system's Now Playing API. On iOS 27 and later, NativeNowPlayingPublisher uses a local NowPlaying.MediaSession as the sole publisher for both AAC and High playback. It updates a MusicContent model, requests system-primary once playback is active, and exposes play, pause, next, previous, and seek commands. Position snapshots are throttled and timestamped so the system can extrapolate between updates. Artwork is supplied by an HTTPS-only, bounded asynchronous provider. The app does not use MPNowPlayingInfoCenter or MPRemoteCommandCenter on this OS path; Apple documents mixing these APIs with the Now Playing framework as undefined behavior.

High Opus now uses an app-owned AVAudioEngine output graph and a nonmixable playback session, sharing the native metadata publisher with Standard AAC. The WebM reader extracts timed packets and the pinned swift-opus package's libopus decoder produces PCM; see the native Opus decision.

On iOS 17 through iOS 26, both qualities use MPNowPlayingInfoCenter. NativeNowPlayingPublisher loads optional artwork asynchronously and discards results belonging to an older artwork URL. Artwork failure does not interrupt audio. WebKit playback and its Media Session bridge remain only as an explicit comparison using the -HydraulophoneWebKitOpus launch argument.

Now Playing surfaces request the validated 2,048-pixel known-host thumbnail variant, falling back to the original URL when the larger image is unavailable. Downloaded artwork uses the same preference within its existing 2 MB limit.

The legacy native remote command center supports play, pause, headphone toggle, next, previous, seek, shuffle, and repeat. Podcast-style interval skip commands are disabled in favor of track navigation. On iOS 27 and later, MediaCommand exposes play, pause, next, previous, and seek; shuffle and repeat remain app controls. Apple requires the app to be foregrounded when it requests system-primary, and the request does not guarantee the system will show the card. See Apple's Now Playing overview and publishing media sessions.

Before the native migration, the 2026-09-23 physical iPhone run reported canBecomeApplicationPrimary=true and isApplicationPrimary=true, while requestToBecomeSystemPrimary() failed with MediaSessionError.internalFailure. The Lock Screen card still showed controls and progress without title or artwork. Standard AAC on the same device did show its title and artwork with the native session active, isolating the failure to High's WebKit audio path. A mixable host AVAudioSession activation preserved some WebKit playback but still failed to become system-primary. Apple's WWDC22 media metadata session states that a mixable session is generally ineligible for Now Playing. A nonmixable host activation had previously interrupted WebKit audio and caused the brief play-then-pause failure, so the diagnostic WebKit path deactivates the host session before starting WebKit. A WebKit-only metadata trial with a fully opaque, visually clear one-pixel view and MediaMetadata successfully assigned also left the card blank on the device. Those experiments were reverted; none is claimed as a fix.

The new native Opus path passed live simulator playback, unbuffered 65%/90% seeks, pause/resume, and quality switching. It was built, installed, and launched on the physical iPhone. The owner confirmed markedly faster startup and a working Lock Screen card on that build. Device logs show successful system-primary requests; the immediate isSystemPrimary snapshot still reads false, so the visual device confirmation is stronger evidence than that immediate property read. No account data or media URL is logged.

Device startup traces: first verified progress at 3.716 seconds, followed by 2.504, 2.731, and 2.491 seconds on subsequent selections. Native readiness after stream resolution took 114, 109, 178, and 280 ms respectively. The remaining startup time is primarily the unchanged InnerTube resolution flow.

Long background sessions, route changes, interruptions, and the full set of headphone/remote commands still need dedicated physical validation. No transcoding or silent background audio is used. Automated tests remain deferred at the owner's request; briefs are in docs/test-briefs/.