How do I play a song using MusicKit SDK for Android?

I downloaded the official apple music example for Android but the code is unreadable with no notes at all and apple hasn't posted docs or guides other than the javadoc which is not really helpful for starting with MusicKit..

I managed to authenticate with my premium Apple Music account and play the example songs in the example app but I can't understand how to play a certain song by its Id, for instance I have this apple music song Id: "1440783625" and I want to retrieve the song's info and play it using MusicKit SDK..


I'd love to get some help from someone that managed to use MusicKit on Android, TNX 🙂

Replies

I managed to play songs by creating a

MediaDescriptionCompat.Builder

object and calling

MediaControllerCompat
          .getMediaController(activity)
          .getTransportControls()
          .playFromMediaId(mediaItem.getMediaId(),
                     mediaItem.getDescription().getExtras());


The SDK works but it has some bugs, for example it stops streaming specific songs after only streaming the first 5-10 seconds of the song (even tho I'm logged in with a premium account and should be able to stream the full song) for example it happens for this song "1456844334" (Wonderwall by Oasis), but other songs it manages to stream the entire song...


Also the Apple Music Web Api doesn't always find songs by their ISRC id, for example it won't find this one "GBAHS1900672" (Ed Sheeran's I Don't Care), I assume because it's a relatively new song, but it's been out for like a month so is it that new?