MusicKit and MPMusicPlayer on Catalyst

I’m converting a MusicKit app from iOS to macOS with Catalyst but can’t get the player to work. The app works flawlessly on iOS but I get the following error in my console on macOS whenever the MPMusicPlayer tries to manipulate the queue by adding a song with a store id

Code Block
[SDKPlayback] Failed to obtain remoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated.}


Both the player, setQueue and play methods are according to the documentation supported on Mac Catalyst 13+:

https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/1624253-setqueue
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/2582424-preparetoplay
https://developer.apple.com/documentation/mediaplayer/mpmediaplayback/1616255-play

Replies

I get this same error on latest Mac Catalyst, and similarly, the same code works perfectly on iOS in my case as well. This is specific to MPMusicPlayerController.applicationQueuePlayer (if I use .systemMusicPlayer instead, it does work on Catalyst... but systemMusicPlayer is not the behavior I want).

Anyone else experience this? Should we submit it as a bug to Apple?
Same error for me, neither MPMusicPlayerController.applicationMusicPlayer nor MPMusicPlayerController.applicationQueuePlayer work on Catalyst.

Hello @zltn, @Tadd and @pawel-wszeborowski, 

Thank you very much for reporting this issue.

We will investigate the root cause of your difficulties with MPMusicPlayerController.applicationMusicPlayer and MPMusicPlayerController.applicationQueuePlayer in macCatalyst apps.

Thanks again for your feedback.

Best regards, 

Hello again @zltn, @Tadd and @pawel-wszeborowski,

We have a possible explanation for the issue you're encountering with MPMusicPlayerController in macCatalyst apps, but we could really use a sample app exhibiting this problem to confirm our current hypothesis.

Would you mind filing a new ticket on Feedback Assistant, including a sample app for macCatalyst that uses applicationMusicPlayer or applicationQueuePlayer in a way that is similar to how your apps are using it?

We would likely be able to quickly check your sample app and provide specific guidance on how to address this issue.

Thank you very much for your help.

Best regards,

@joekun were you able to track this issue down? Thank you.

  • Hello @marstall,

    As I said before, we could really use a sample app exhibiting this problem to confirm our current hypothesis.

    Would you mind filing a new ticket on Feedback Assistant, including a sample app for macCatalyst that uses applicationMusicPlayer or applicationQueuePlayer in a way that is similar to how your apps are using it?

    We would likely be able to quickly check your sample app and provide specific guidance on how to address this issue.

    Thank you very much for your help.

    Best regards,

  • I'm facing the same issue using the ApplicationMusicPlayer. It there a solution to this?

  • Hello @snuff4,

    We do not have any update on this front. But we could really use a sample app exhibiting this problem to confirm our current hypothesis.

    Would you mind filing a new ticket on Feedback Assistant, including a sample app for macCatalyst that uses applicationMusicPlayer or applicationQueuePlayer in a way that is similar to how your apps are using it?

    We would likely be able to quickly check your sample app and provide specific guidance on how to address this issue. Thank you very much for your help.

    Best regards,

We have MPMusicPlayerApplicationController.applicationQueuePlayer working with Catalyst, but user experience is awful. When Catalyst app calls any methods of a player, the Apple Music application launches in a background and while it is launching (takes several seconds on pretty powerful MacBook Pro with 8-core i9 CPU and 16Gb of RAM), Catalyst app is totally frozen with "rainbow wheel of death" shown... Maybe it is expected behavior from technical stand-point, but it is no way desirable from user experience stand point! Any comments, Apple? Thank you!

  • This was my experience on Big Sur -- I had been hoping it was fixed in Monterrey but hadn't had a chance to test. Are you on the latest OS @oxigenator?

  • @oxigenator how were you able to at least execute something on the player? I cannot play anything

Add a Comment