witnessmenow / spotify-api-arduino

Arduino library for integrating with the Spotify Web-API (Does not play music)
MIT License
178 stars 33 forks source link

Request time #59

Closed TheKerbecs closed 11 months ago

TheKerbecs commented 1 year ago

When making a request to check if a song is playing it takes about 900ms to 1000ms to make the request, which causes the rest of my program to freeze. Is there a way to speed that up? This is part of my sketch:

void loop(){
    if (millis() > requestDueTime) {
       int status = spotify.getCurrentlyPlaying(updatePlaying, SPOTIFY_MARKET);
      requestDueTime = millis() + delayBetweenRequests;
    }

 }
void updatePlaying(CurrentlyPlaying currentlyPlaying) {
   isPlaying = currentlyPlaying.isPlaying;
}
witnessmenow commented 11 months ago

No way to to speed it up with the way this library is designed. It could be possible to do it a different way but I'm not sure.

If your using an esp32 you can pass one of the tasks onto the second core if you don't want your application to hang while making the request