Hi everyone,
I’m developing a native Apple TV application using MusicKit for Swift. The app provides a custom interface for browsing and playing the user’s personal Apple Music library.
The application was working correctly for several months, but recently certain songs from the user’s personal library have stopped playing.
I’ve been investigating this issue extensively and have reproduced it in a completely separate, minimal tvOS test application.
The issue
I retrieve songs using MusicLibraryRequest<Song>() and play them using ApplicationMusicPlayer.
Some songs play successfully, while others consistently fail during playback preparation with:
`MPMusicPlayerControllerErrorDomain Code=6
"Prepare to play failed"`
The underlying errors include :
NSCocoaErrorDomain Code=4099
Example of a failing song
Michael Jackson — Bad (2012 Remaster)
- Library song ID: i.ldDOAp0UrAa62J
- Successfully retrieved using MusicLibraryRequest<Song>()
- Fails when queued with ApplicationMusicPlayer
- Also fails with SystemMusicPlayer
Example of a working song
Harry Nilsson — Everybody’s Talkin’ (1971 Mix)
- Library song ID: i.WmYQp9PcdZ4Y0E
- Retrieved using the exact same MusicLibraryRequest<Song>()
- Successfully plays using ApplicationMusicPlayer
Both songs have library identifiers beginning with i..
What I’ve tested
- ApplicationMusicPlayer with prepareToPlay() followed by play().
- SystemMusicPlayer with the same library song.
- Direct play() without explicitly calling prepareToPlay().
- Retrieving songs directly using MusicLibraryRequest<Song>(), rather than accessing them through albums.
- A completely separate minimal tvOS application.
- An older version of my application’s code, recompiled using the current Xcode version.
The issue persists across these tests.
Interestingly, the corresponding Apple Music catalog song plays successfully when retrieved through MusicCatalogSearchRequest.
However, replacing library songs with catalog equivalents is not an acceptable solution because the application needs to support users’ actual personal libraries, including imported music.
Important observation
The exact same failing song plays correctly on the same Apple TV and Apple Music account in:
- The official Apple Music application.
- Sleeve, another third-party Apple TV music player.
This suggests that the song itself is playable and that another third-party application can successfully initiate playback.
Environment
- Platform: tvOS
- Device: Physical Apple TV
- Framework: MusicKit for Swift
- Apple Music authorization: Granted
- MusicKit App Service: Enabled
- Signing: Automatic, using a paid Apple Developer account
Question
Is there a known issue with resolving or playing certain personal library songs through MusicKit on tvOS?
Are there additional playback parameters, library synchronization requirements, or recommended queue configurations that could explain why some MusicLibraryRequest<Song>() items fail while others work?
Has anyone encountered a similar issue or found a workaround that preserves playback of the user’s actual library items?
Any guidance would be greatly appreciated.
Thank you!
Thanks for the detailed write-up. Please consider filing a bug report about this so our engineering teams can investigate this issue. A resolution may involve changes to Apple's software. Include your minimal project, which library songs fail and which play, and a sysdiagnose captured right after a failure. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports. Anyone else seeing this, please file your own report too.
Bug Reporting: How and Why? has tips on creating
your bug report.