Our music player plays library and Apple Music catalog content with MusicKit's ApplicationMusicPlayer. On the Mac, we want a volume slider that changes only our app's playback level, like the slider in Music.app.
We found no supported way to do this:
- ApplicationMusicPlayer and MusicPlayer have no volume property.
- The audio plays in com.apple.MediaPlayer.RemotePlayerService, not in our process, so we cannot change the stream level.
- MPVolumeView and the deprecated MPMusicPlayerController.volume control the system output volume, not the app's level.
- AVPlayer cannot play Apple Music catalog content.
Questions:
- Is there a supported API to set the playback volume of ApplicationMusicPlayer on macOS or Mac Catalyst?
- If there is none, what does Apple recommend for Mac apps that need an app-level volume control for MusicKit playback?
Thanks for listing everything you've already ruled out.
Your survey matches mine: I don't see a supported API for setting the playback volume of ApplicationMusicPlayer on macOS or Mac Catalyst. The MusicKit SDK declares no volume control for MusicPlayer or its subclasses. The MPVolumeView documentation describes it as "A slider control for setting the system audio output volume." The deprecated volume property of MPMusicPlayerController points to MPVolumeView for "adjusting system playback volume."
I also don't have an alternative to recommend. I'm not aware of any documented way to change the level of MusicKit playback independently of the system volume.
Please file an enhancement request using Feedback Assistant describing your use case. Your report can reference FB21042385 from the reply above. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.
Please note that filing an enhancement request does not guarantee Apple will add any requested functionality to Apple products in the future. However, with that said, filing an enhancement request is a good way to get your ideas in front of the folks who make decisions about that sort of thing.
If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?