Catalyst - Cannot play media with SystemMusicPlayer

Since the latest updates of macOS, probably 14.1, I have not been able to play media using SystemMusicPlayer.shared or MPMusicPlayerController.systemMusicPlayer. ApplicationMusicPlayer still works.

This is the error code I am encountering:

systemMusicPlayer _establishConnectionIfNeeded failed [application failed to launch]
Failed to prepareToPlay with error: Error Domain=MPMusicPlayerControllerErrorDomain Code=10 "Failed to obtain remoteObject [nil server]" UserInfo={NSDebugDescription=Failed to obtain remoteObject [nil server]}

Here is a small example to reproduce the bug.

MPMusicPlayerController.systemMusicPlayer.setQueue(with: ["1445887715"])
MPMusicPlayerController.systemMusicPlayer.prepareToPlay()

Or:

extension PlayableMusicItem {
    
    // Not working
    func playWithSystemPlayer() {
        Task {
            SystemMusicPlayer.shared.queue = [self]
            try await SystemMusicPlayer.shared.play()
        }
    }

    // Working
    func playWithApplicationPlayer() {
        Task {
            ApplicationMusicPlayer.shared.queue = [self]
            try await ApplicationMusicPlayer.shared.play()
        }
    }
}

FB13364138

Me too. I never used this before, and am trying to port an existing iOS app, that plays music, to macOS. It seems that MediaPlayerItem etc APIs are not available on macOS so I am now trying out Mac Catalyst. Most of things seem to work well but when it comes to playing back music content (via Apple Music), I get this same error.

Catalyst - Cannot play media with SystemMusicPlayer
 
 
Q