Apple MusicKit randomly not playing some songs

Hello all,


We are integrating Apple Music (MPMusicPlayerController, applicationMusicPlayer) in our iOS mobile app.

Most of the times Apple Music is correctly playing the tracks, but from time to time the setQueue method fails without any specific error. We are able to see sometimes:

MPCPlayerRequestErrorDomain Code=1000 or

MPCPlayerRequestErrorDomain Code=2000


After a random period of time (1 week) the same songs are playing.


The songs always work perfectly on the Apple Music app.


STEPS TO REPRODUCE

// This song was not playing for a while, it does today
let NOT_WORKING: String = "1433512175" // https://api.music.apple.com/v1/catalog/ch/songs/1433512175

// Init the music player
self.cloudPlayer = MPMusicPlayerController.applicationMusicPlayer

// Request permission 
SKCloudServiceController.requestAuthorization({ (status) in
     if (status == .authorized) {
          let controller = SKCloudServiceController()
          controller.requestCapabilities(completionHandler: { (capabilities, error) in
               if let _ = error {
                    print("Error")

                    return
               }

               if capabilities.contains(.musicCatalogPlayback) {
                    // Play a track
                    self.cloudPlayer?.setQueue(with: [self.NOT_WORKING])

                    DispatchQueue.main.async {
                         self.cloudPlayer?.prepareToPlay {_ in
                              print("Loaded, start playing")
                              self.cloudPlayer?.play()
                         }
                   }
               }
          })
     }
})


Thank you,

Jean

Replies

I'm also facing same issue. Have you get solution for it?