MPMusicPlayerApplicationController stops playing in background after exactly 30 songs

I have an app which plays songs from Apple Music using MPMusicPlayerController.applicationQueuePlayer. I am constantly connecting to my backend and updating the song queue using player.prepend(MPMusicPlayerStoreQueueDescriptor(storeIDs: ids)).


In order to test the app, I left it running overnight in background. In the morning the music was not playing, the lock screen doesn't show any music controls and my app was not running - seems like when the music was stopped ios killed my app since it doesn't do anything in the background. When I go back to my app the playback is totally broken, when I try to play the next track or start playback again - nothing works, I need to kill the app and start over again.


I did this test several times and every time after about 1.5 hours the app stops playing after it plays exactly 30 songs. Interestingly, I'm always prepending 30 songs using player.prepend(), however, debugging showed that the song queue is actually bigger, like 105 songs or so. When I'm looking at the logs then I see all possible error logs and warnings from music player during those 1.5 hours, but the music plays fine during that time. The one interesting log is TIMEOUT at the end, even though during this 1.5 hours I get similar message 4 times, however the last one ends my app.


I got no hopes with the official Feedback Assistant since they totally ignore for months everything I write there, not even writing back "we got it, we are looking into it", so I'm trying my luck here and in SO.


Here are the logs with timestamps, filtered to leave only meda player related logs (full logs here)


2019-11-30 04:04:36.175688+0100 MyApp[4278:1630772] [Middleware] TIMEOUT Request: <MPCPlayerRequest: 0x280d0a520 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> timing out.
2019-11-30 04:04:36.221643+0100 MyApp[4278:1630772] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d56ac0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [5.396877s] error: Error Domain=MPRequestErrorDomain Code=2 "(null)"
2019-11-30 04:04:36.227077+0100 MyApp[4278:1630772] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d54240 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.113625s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28318f180 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 04:04:36.229159+0100 MyApp[4278:1630772] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28318f180 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}




OPENING THE APP NEXT DAY ->




2019-11-30 13:01:33.528720+0100 MyApp[4278:1711694] [SDKPlayback] -[MPMusicPlayerController prependQueueDescriptor] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 125" UserInfo={NSDebugDescription=Failed to send command 125, NSUnderlyingError=0x2831bdef0 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 125 (MRSendCommandError = 5)" UserInfo={NSDebugDescription=Failed to send command 125 (MRSendCommandError = 5)}}}
2019-11-30 13:01:33.667624+0100 MyApp[4278:1630937] [] nw_read_request_report [C61] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.668843+0100 MyApp[4278:1630937] [] nw_read_request_report [C30] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.683226+0100 MyApp[4278:1711697] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d337b0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.174930s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x2831784e0 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:33.683451+0100 MyApp[4278:1711694] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x2831784e0 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:33.687983+0100 MyApp[4278:1630937] [] nw_read_request_report [C61] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.701848+0100 MyApp[4278:1630937] [] nw_read_request_report [C30] Receive failed with error "Software caused connection abort"
2019-11-30 13:01:33.799727+0100 MyApp[4278:1630937] Task <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034> HTTP load failed, 190/0 bytes (error code: -1005 [1:53])
2019-11-30 13:01:33.800991+0100 MyApp[4278:1711694] Task <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x283014a50 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x281c7df90 [0x1d868f5e0]>{length = 16, capacity = 16, bytes = 0x100201bb8fcc65250000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <3A190957-09C8-416C-8B08-DCBE691C35A0>.<1034>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://<mybackend>/updatePlaybackInfo, NSErrorFailingURLKey=https://<mybackend>/updatePlaybackInfo, _kCFStreamErrorDomainKey=1}
2019-11-30 13:01:33.801301+0100 MyApp[4278:1711694] [Error]: The network connection was lost. (Code: 100, Version: 1.17.3)
2019-11-30 13:01:33.801515+0100 MyApp[4278:1711694] [Error]: Network connection failed. Making attempt 1 after sleeping for 1.390448 seconds.
2019-11-30 13:01:33.971848+0100 MyApp[4278:1711694] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d2abe0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.037286s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283050210 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:33.973632+0100 MyApp[4278:1630937] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283050210 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.277935+0100 MyApp[4278:1630937] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d6b060 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.002645s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28302d560 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.278317+0100 MyApp[4278:1711695] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x28302d560 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.503560+0100 MyApp[4278:1630937] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d2b180 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.014466s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283051260 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.505085+0100 MyApp[4278:1711695] [Middleware] RRC <MPCPlayerRequest 0x280d61710>: Request failed with error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283051260 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
2019-11-30 13:01:34.873151+0100 MyApp[4278:1711695] [Middleware] FINISH Request: <MPCPlayerRequest: 0x280d68c60 label=MPMusicPlayerController-applicationMusicPlayer playerPath=<MPCPlayerPath: route=<MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL> bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController>> Response: (null) [0.004019s] error: Error Domain=MPRequestErrorDomain Code=1 "(null)" UserInfo={MPRequestUnderlyingErrorsUserInfoKey=(
    "Error Domain=MPCPlayerRequestErrorDomain Code=2000 \"Failed to get play queue identifers\" UserInfo={NSDebugDescription=Failed to get play queue identifers, NSUnderlyingError=0x283084600 {Error Domain=kMRMediaRemoteFrameworkErrorDomain Code=35 \"Could not find the specified now playing client\" UserInfo={NSLocalizedDescription=Could not find the specified now playing client}}}"
)}
...

Replies

Hey weeto,


I'm getting a similar error, but using the music player that only functions within the app. It happens after I do the following:

  1. Have a song playing with no songs in the queue
  2. Call prepend() with a song so that the queue has just the one
  3. Skip the currently playing song (has to be skipped, if the song ends normally there is no issue)


When I try to use prepend() again after the skip(to always keep one song in the queue), the error is thrown. This is all in the foreground, so perhaps that isn't the issue.


Error message:


[SDKPlayback] -[MPMusicPlayerController prependQueueDescriptor] completed id=applicationMusicPlayer error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 125" UserInfo={NSDebugDescription=Failed to send command 125, NSUnderlyingError=0x282c008a0 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 125 (MRSendCommandError = 7)" UserInfo={NSDebugDescription=Failed to send command 125 (MRSendCommandError = 7)}}}


The underlying error and MRSendCommandError are different, but yours is the most similar error message I've found on the forums so I wanted to check in and see if you'd figured anything out with this. Also, is there documentation on the command error codes anywhere? That could potentially help identify the issues.

Thanks