Hello,
I'm the developer of an Apple Music app called Soor, I've been recently working on adding Catalyst support to the app.
However, I've noticed some severe bugs while setting the queue for playing non-library items on macOS 12.2.
Both MPMusicPlayerPlayParametersQueueDescriptor
and MPMusicPlayerStoreQueueDescriptor
fail to play items using valid playbackStore identifiers.
The console logs the following errors:
[SDKPlayback] systemMusicPlayer _establishConnectionIfNeeded timeout [ping did not pong]
`[SDKPlayback] Failed to prepareToPlay error: Error Domain=NSOSStatusErrorDomain Code=9205 "(null)"`
I have filed radars for this along with sample projects showcasing the issue. FB9890270
and FB9890331
.
Here's a gist of the sample code for which the player either completely fails to set the queue or now playing item stays nil.
/// These are valid playback store ids retrieved from Apple Music API.
/// You may replace them with any valid playback store IDs of your choice.
let playbackStoreIDs = ["1588418743", "1604815955", "1596475453", "1562346959", "1596475469", "1596475460", "1580955750", "1591442362", "1607324602", "1531596345"]
var playParams = [MPMusicPlayerPlayParameters]()
for playbackStoreID in playbackStoreIDs {
let param = MPMusicPlayerPlayParameters(dictionary: ["id": playbackStoreID, "kind": "song"])!
playParams.append(param)
}
let queueDesc = MPMusicPlayerPlayParametersQueueDescriptor(playParametersQueue: playParams)
queueDesc.startItemPlayParameters = playParams[3]
player.setQueue(with: queueDesc)
player.play()
Has anyone managed to playback music correctly using only playback store ids on Catalyst?