8

I am working on an application using the Spotify and Apple Music APIs. Spotify has an endpoint called /me/player/currently-playing that returns the logged in user's currently playing song. Is there an equivalent for the Apple Music API?

I know the Apple Music API has a "get recently played" endpoint but I'm not sure if this endpoint will return the users currently playing song. Is there maybe another service I could use to accomplish this goal for Apple Music?

RangerRick
  • 266
  • 4
  • 17

2 Answers2

0

Unfortunately their API is pretty lame. If you not play anything at the moment you still got a song that was played recently even if that recently was a day ago. Even worse there is no unixdate attached result so you don't know when the song was last accessed.

Sebastian
  • 448
  • 4
  • 14
  • I appreciate this answer! So, are you saying that if the user _is_ currently playing music, then the `recently-playing` endpoint will return the currently playing track? – RangerRick Dec 06 '21 at 17:30
  • Technically yes, but if you play Taylor Swift in a loop it will returned her song only once which is lame. You won't detect by API itself is user is playing song. You can detect this only if user is using your app as each different device have different instances of MusicKit ans isPlaying is I believe method in MusicKit.player. I am trying to buld web player using React so currently struggling with this myself – Sebastian Dec 07 '21 at 23:37
0

Well, there's no API support for the Currently Playing Song, but you can fetch the last recently played song and check if the Music Player is playing or pause.

Neyk
  • 5
  • 1