Playing Apple Music tracks in iOS apps

Allen Pike • Nov 22nd, 2016

Last year, we told the tale of the many issues we have with streaming and DRMed music on iOS in Party Monster and WeddingDJ. The core issue is that Apple’s AVFoundation APIs, the ones that allow you to build advanced audio apps, are not compatible with Apple Music and the various iTunes features that depend on The Cloud™.

Over time, these cloud services have become popular enough that our inability to support them has become our No. 1 support request by far. The issue is also the source of almost all of our negative reviews. This has hurt all DJ apps, from the mighty Djay to our more casual party management tools. It doesn’t look like Apple Music support is coming to AVFoundation any time soon, so Rob here at Steamclock took the time to research and prototype the other option: dropping AVFoundation in favour of the higher-level Media Player APIs that do support Apple Music.

After a couple weeks of prototyping and research work, we must say with heavy heart that you can’t make a quality music app in the style of Party Monster or WeddingDJ that works with Apple Music. At least, not yet. Not as of iOS 10.

Here be dragons

Where it is much less flexible than the AVFoundation APIs, the simpler MPMediaPlayerController does support playing Apple Music, DRMed tracks, and other iCloud audio. Unfortunately, it is more like a set of levers with which you can poke the system Music app than an API for making music apps. If the system Music app can’t do it, the player can’t do it. Even if the system Music app can do it, the player sometimes can’t.

In the spirit of dutifully reporting bugs and issues to Apple, we filed some of the issues we encountered:

Given these limitations and issues, MPMediaPlayer may not be the way forward after all. It may turn out to be easier for Apple to provide a sandboxed API that can decode Apple Music or other DRMed traks and provide them to the AVFoundation layer, which already works great. This would not only let us support Apple Music in personal apps like Party Monster, it would allow much more sophisticated apps like Djay to support the service.

In the meantime, these limitations mean that any music app that attempts to play Apple Music tracks will be seriously limited, require odd workarounds, and behave problematically depending on user behaviour. In the spirit of giving users a quality experience, we’re stuck with the same limitation that other sophisticated audio apps have today: no Apple Music.

With luck, our time will come soon. Here’s to iOS 11!

Allen Pike • CEO