More on Spotify Connect and iPhone Volume Buttons

Emma Roth, reporting for The Verge last week:

Spotify users on iPhone will no longer be able to control the volume on connected devices using their physical volume buttons. In an update to its support page, Spotify said Apple “discontinued” this technology, forcing iPhone owners to use an annoying workaround. [...]

“We’ve made requests to Apple to introduce a similar solution to what they offer users on HomePod and Apple TV for app developers who control non-Apple media devices,” Spotify says in its update. “Apple has told us that they require apps to integrate into Home Pod in order to access the technology that controls volume on iPhones.”

I believe Spotify has subsequently edited their support page, because the above text no longer appear here, where it now reads:

Apple has discontinued the technology that enables Spotify to control volume for connected devices using the volume buttons on the device. While we work with them on a solution, you can use the Spotify app to easily adjust the volume on your connected device.

It remains unclear to me exactly what is going on here. I think what happened is that what Spotify was doing to enable users to use the hardware volume buttons on their iPhones to control the volume of playback on other devices via Spotify Connect was making use of private or undocumented APIs, and Apple shut those APIs down in iOS 17.6. In short, that it was a hack that stopped working or just stopped working reliably.

But I was wrong yesterday to say — in the headline of the post, of all places — that Spotify could solve the problem by adopting AirPlay 2. Spotify Connect is, and needs to be, its own separate thing. Spotify users who use Connect love it. Here’s what one DF reader wrote to me: “AirPlay is a per-device feature, while Spotify Connect synchronizes Spotify sessions across devices. I can initiate playing on my iPhone, then control it from my iPad, Mac, or Watch. I can change the destination speaker from any device. It’s so good that I’m forever wedded to Spotify until Apple or someone else comes up with an equivalent experience. I think if AirPlay offered equivalent functionality, but Spotify refused to adopt it, Spotify would be open to more criticism, but from the perspective of a Spotify user, it’s lost functionality and even supporting AirPlay 2 would not fix what is now a diminished experience. So I think Spotify is doing the only thing they can, which is complain.”

The basic gist is that Apple has always controlled the hardware buttons and switches on iOS devices. Games can’t use the volume buttons as, say, left/right or up/down buttons. In the very early years of the App Store third-party camera apps started using the volume buttons as camera shutter buttons, but Apple then forbade it — and then started using those buttons as shutter buttons in the system Camera app, and then, like 15 years later, finally added an API for this use case in iOS 17.2.

But note that new API is only for using these buttons for capture:

Important You can only use this API for capture use cases. The system sends capture events only to apps that actively use the camera. Backgrounded capture apps, and apps not performing capture, don’t receive events.

Spotify (and Sonos) were clearly using the hardware volume buttons in ways unapproved. It’s fair to argue that Apple should provide APIs they can use, especially if it’s for controlling audio volume, even if on another device. But they don’t.

Also worth noting: when using Apple’s own Remote app to control an Apple TV, the iPhone hardware volume buttons adjust the volume on the Apple TV. According to Apple this also works when using the Remote app to control an AirPlay-compatible smart TV. That’s the ability Spotify and Sonos seek for themselves.

See also: Michael Tsai.

Update: I think Marco Arment nailed it:

My guess is this API, which has been deprecated for a decade:
developer.apple.com/documentation/[...]/mpmusicplayercontroller/

It’s the only way we’ve ever been able to programmatically set the iPhone volume, so it’s how apps would intercept volume buttons: observe it for changes, and upon a change, immediately set it back, then perform the custom action.

The only other known method is subview-diving on the MPVolumeView, but I don’t think that was ever reliable enough to actually write changes to the volume.

In other words, it wasn’t just a hack that stopped working, it was a pretty filthy hack that stopped working. There has never been an API for third-party apps to use the hardware volume buttons to do what Spotify Connect and Sonos were doing. There should be. But there never was, and still isn’t.

Friday, 6 September 2024