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?
Post
Replies
Boosts
Views
Activity
Already filed a bug report about this (FB8082757) but posting here incase anyone knows a workaround.
Since iOS 14 Beta 2, the requestPersonalizationToken(forClientToken:completionHandler:) returns an invalid token and prevents any personalised Apple Music API requests from working.
Last reproduced on iOS 14 (18A5319i) on an iPhone X.
Steps to reproduce:
Generate a valid MusicKit Developer Token.
Use SKCloudServiceController's requestPersonalizationToken(forClientToken:completionHandler:) function to get a user token.
Perform an Apple Music API request that specifically requires a user token, for example fetching Recommendations (developer.apple.com/documentation/applemusicapi/recommendations).
Apple Music API callback will fail with a 403 error code and error as Invalid authentication.
This happens only on iOS 14. All iOS versions before that including the latest iOS 13 do not exhibit this issue.