Hello,
I'm using systemMusicPlayer to play Apple Music Live Radio Station got from Apple Music API. But it doesn't work. How can I do that?
- Error:
Test[46751:13235249] [SDKPlayback] Failed to prepareToPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=6 "Failed to prepare to play" UserInfo={NSDebugDescription=Failed to prepare to play}
- My implementation:
let musicPlayerController = MPMusicPlayerController.systemMusicPlayer
musicPlayerController.beginGeneratingPlaybackNotifications()
musicPlayerController.setQueue(with: "ra.978194965")
musicPlayerController.play()
- API response:
{
“id”: “ra.978194965”,
“type”: “stations”,
“href”: “/v1/catalog/us/stations/ra.978194965”,
“attributes”: {
“artwork”: {
“width”: 4320,
“url”: “https://is2-ssl.mzstatic.com/image/thumb/Features114/v4/e5/10/76/e5107683-9e51-ebc5-3901-d8fbd65f2c2a/source/{w}x{h}sr.jpeg”,
“height”: 1080,
“textColor3”: “332628”,
“textColor2”: “120509”,
“textColor4”: “33272a”,
“textColor1”: “000000”,
“bgColor”: “f4f4f4”,
“hasP3”: false
},
“url”: “https://music.apple.com/us/station/apple-music-1/ra.978194965”,
“mediaKind”: “audio”,
“supportedDrms”: [
“fairplay”,
“playready”,
“widevine”
],
“requiresSubscription”: false,
“name”: “Apple Music 1”,
“kind”: “streaming”,
“radioUrl”: “itsradio://music.apple.com/us/station/ra.978194965”,
“playParams”: {
“id”: “ra.978194965”,
“kind”: “radioStation”,
“format”: “stream”,
“stationHash”: “CgkIBRoFlaS40gMQBA”,
“mediaType”: 0
},
“editorialNotes”: {
“name”: “Apple Music 1”,
“short”: “The new music that matters.”,
“tagline”: “The new music that matters.”
},
“isLive”: true
}
},```
Thank you!
Best regards,
MichaelNg