2 Replies
      Latest reply on Feb 11, 2020 3:30 PM by hbhbjhjhb
      AlexPartyPlay Level 1 Level 1 (0 points)

        Hi, I'm trying to play Apple Music songs using storeID like this:

         

        playerController = MPMusicPlayerController.applicationMusicPlayer
        playerController?.beginGeneratingPlaybackNotifications()
        playerController?.setQueue(with: [storeID])
        playerController?.prepareToPlay() { error in
             if error == nil {
                  playerController?.play()
             }
        }

         

        The problem is that sometimes the playback starts as expected and sometimes just gives me this log without explaining anything else:

         

        [SDKPlayback] -[MPMusicPlayerController play] completed error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0" UserInfo={NSDebugDescription=Failed to send command 0, NSUnderlyingError=0x1d4a44680 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1)" UserInfo={NSDebugDescription=Failed to send command 0 (MRMediaRemoteCommandHandlerStatus = 1), MPCPlayerErrorKeyMediaRemoteCommandHandlerStatus=1}}}
        
        [SDKPlayback] Failed validators: {(
            play
        )}

        I can't observe that error to try something else, cause the play() method doesn't give's any return, closure, notification, to track it.

         

        Do you know how can I at least observe that? Is it normal?

         

        I tested this in iOS 11.4 and iOS 12 beta and I'm sure that the items are available to playback.

         

        Thank you so much in advance!