Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Does the currently playing API include the track's associated colour like the embed of a track does?

Does the currently playing API include the track's associated colour like the embed of a track does?

 

My Question or Issue

I am wondering if I can use the track's associated colour using an API call.
Currently I get the currently playing track with the following function:

 

function callApi(method, url, body, callback){
    let xhr = new XMLHttpRequest();
    xhr.open(method, url, true);
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
    xhr.send(body);
    xhr.onload = callback;
}
// callback function to handle API response.

 

Then in my callback function I access the track's name, artist name, image etc... However I would also like to use the color that is assigned to the track like you can in the embed. See attachments to get some more context of exactly what I am talking about.

Screenshot 2023-12-30 at 9.34.31 PM.png
Reply
0 Replies

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random