Apple Music API Get Currently Playing Song
Asked Answered
E

2

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?

Eskil answered 13/4, 2020 at 14:35 Comment(0)
T
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.

Tinkling answered 6/12, 2021 at 14:11 Comment(2)
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?Eskil
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 myselfTinkling
B
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.

Buller answered 16/1, 2023 at 13:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.