Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour of player controls function #69

Open
roogue opened this issue Mar 21, 2024 · 2 comments
Open

Strange behaviour of player controls function #69

roogue opened this issue Mar 21, 2024 · 2 comments

Comments

@roogue
Copy link

roogue commented Mar 21, 2024

Hi I am new to C++ language and this library. So far this library works for my project, however, the spotify.play() function will always fail with the following message.

/v1/me/player/play
api.spotify.com
[ 11307][E][ssl_client.cpp:37] _handle_error(): [send_ssl_data():382]: (-80) UNKNOWN ERROR CODE (0050)
Failed to send request

The strange thing is, the request was actually sent successfully, and my music was played as intended.

Additional Info:

  • I have a Spotify premium account
  • The function was only called once
@roogue
Copy link
Author

roogue commented Mar 22, 2024

Update: I met the same issue even if I ran the exact same code from your getRefreshToken.ino example. I am doubting maybe it is the behavior of the WifiClientSecure library.

Connected to xxx wifi
IP address: 192.168.x.xxx
MDNS responder started
HTTP server started
grant_type=authorization_code&code=xxxx
accounts.spotify.com
Status: HTTP/1.0 200 OK
HTTP Version: HTTP/1.0
Status Code: 200
status Code200
[  5379][E][ssl_client.cpp:37] _handle_error(): [data_to_read():361]: (-80) UNKNOWN ERROR CODE (0050)

Edit: It happens randomly too, sometimes it behaves as intended.

@roogue
Copy link
Author

roogue commented Mar 22, 2024

I think I found the problem, the issue occurred in SpotifyArduino.cpp lines 86, under makeRequestWithBody() function.

Somehow it happened when an empty body was printed with client->print(body);

I made a tad bit changes to the code and everything seems working again,

From

client->print(body);

To

if (strlen(body) == 0)
{
    client->println();
}
else
{
    client->print(body);
}

Where I use client->println(); instead when printing an empty body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant