Posts

Post not yet marked as solved
0 Replies
334 Views
I'm writing an Android app that uses the Apple MusicKit SDK for Android. I am trying to understand how to handle the Apple Music user token, once I got it from authentication flow. I don't know when the token will expire, it is not a regular jwt token, so I cannot check the expiration date. And I don't want to run the auth flow on every app run, it will be annoying for the users. Any guidance on how to handle and invalidate apple music user tokens?
Posted
by weeto.
Last updated
.
Post not yet marked as solved
1 Replies
293 Views
I have downloaded the official Apple MusicKit SDK for Android and integrated 2 AARs it has in my app (musickitauth-release-1.1.2.aar and mediaplayback-release-1.1.1.aar). When I try to build my app I'm getting an error: Manifest merger failed : android:exported needs to be explicitly specified for element <activity#com.apple.android.sdk.authentication.SDKUriHandlerActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Which makes sense, since when I look into the AAR's AndroidManifest.xml I see that this is missing in SDKUriHandlerActivity. Can this be fixed?
Posted
by weeto.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
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: &lt;MPCPlayerRequest: 0x280d0a520 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; timing out. 2019-11-30 04:04:36.221643+0100 MyApp[4278:1630772] [Middleware] FINISH Request: &lt;MPCPlayerRequest: 0x280d56ac0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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: &lt;MPCPlayerRequest: 0x280d54240 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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 &lt;MPCPlayerRequest 0x280d61710&gt;: 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 -&gt; 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: &lt;MPCPlayerRequest: 0x280d337b0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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 &lt;MPCPlayerRequest 0x280d61710&gt;: 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 &lt;3A190957-09C8-416C-8B08-DCBE691C35A0&gt;.&lt;1034&gt; HTTP load failed, 190/0 bytes (error code: -1005 [1:53]) 2019-11-30 13:01:33.800991+0100 MyApp[4278:1711694] Task &lt;3A190957-09C8-416C-8B08-DCBE691C35A0&gt;.&lt;1034&gt; 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=&lt;CFData 0x281c7df90 [0x1d868f5e0]&gt;{length = 16, capacity = 16, bytes = 0x100201bb8fcc65250000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &lt;3A190957-09C8-416C-8B08-DCBE691C35A0&gt;.&lt;1034&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask &lt;3A190957-09C8-416C-8B08-DCBE691C35A0&gt;.&lt;1034&gt;" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://&lt;mybackend&gt;/updatePlaybackInfo, NSErrorFailingURLKey=https://&lt;mybackend&gt;/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: &lt;MPCPlayerRequest: 0x280d2abe0 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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 &lt;MPCPlayerRequest 0x280d61710&gt;: 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: &lt;MPCPlayerRequest: 0x280d6b060 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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 &lt;MPCPlayerRequest 0x280d61710&gt;: 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: &lt;MPCPlayerRequest: 0x280d2b180 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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 &lt;MPCPlayerRequest 0x280d61710&gt;: 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: &lt;MPCPlayerRequest: 0x280d68c60 label=MPMusicPlayerController-applicationMusicPlayer playerPath=&lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x280a0a940 name=iPhone uid=LOCAL&gt; bundleID=com.apple.MediaPlayer.RemotePlayerService pid=4281 playerID=MPMusicPlayerApplicationController&gt;&gt; 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}}}" )} ...
Posted
by weeto.
Last updated
.
Post not yet marked as solved
0 Replies
776 Views
Sometimes the MPMusicPlayerController is not playing the music when I start my app. I'm getting following errors (or very similar):[SDKPlayback] -[MPMusicPlayerController prepareToPlay] completed error: Error Domain=MPCPlayerRequestErrorDomain Code=1 "No commands provided." UserInfo={NSDebugDescription=No commands provided.}[SDKPlayback] -[MPMusicPlayerController prepareToPlayWithCompletionHandler:] completed error: Error Domain=MPCPlayerRequestErrorDomain Code=1 "No commands provided." UserInfo={NSDebugDescription=No commands provided.}[MediaRemote] MRC &lt;MPCPlayerPath: route=&lt;MPAVEndpointRoute: 0x281e90540 name=iPhone uid=LOCAL&gt; origin=Nastasia's iPhone-1280262988 bundleID=com.apple.MediaPlayer.RemotePlayerService playerID=MPMusicPlayerApplicationController&gt;: Undo optimistic state [failed] command=Play error=Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRSendCommandError = 4)" UserInfo={NSDebugDescription=Failed to send command 0 (MRSendCommandError = 4)}[SDKPlayback] -[MPMusicPlayerController play] completed error: Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0" UserInfo={NSDebugDescription=Failed to send command 0, NSUnderlyingError=0x28256b840 {Error Domain=MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0 (MRSendCommandError = 4)" UserInfo={NSDebugDescription=Failed to send command 0 (MRSendCommandError = 4)}}}I'm trying to play songs from Apple Music using the user's paid subscription, so I'm setting the queue with store IDs.One thing that almost always fixes the situation is opening the iOS Music app, playing something there and coming back to my app.Here are some extra conditions to consider:I'm still in development mode so all that happens during deploying the app to my device in debug modeThis happens often after I kill the app from Xcode to make some changes in code and then run the app againI have relatively old iPhone 6s with iOS 12.4.Given all those conditions, I still see a lot of people having similar problems and no workaround till now.If anyone ever experienced this - please let me know how to fix it or if there is a workaround to this.
Posted
by weeto.
Last updated
.
Post not yet marked as solved
0 Replies
427 Views
There are so many points where it seems not to be possible to access data using Apple Music API. For example, there is a "get activity" request, however I need an ID of an Activity. What should I do to get one of those, from which request do I get them? I would like to show a list of catalog Activities or maybe just "TOP" activities/moods/etc from the beginning, not depending on anything else. The same thing applies to other data, like Apple Curators, and so on.There is already a question regarding the same issue, but it is quite old and no one answered it yet - https://forums.developer.apple.com/thread/90911Are there any parameters that I'm missing or is it just not possible with this API? That would make also endpoints like "get activity" useless...
Posted
by weeto.
Last updated
.