spotify / web-playback-sdk

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web Playback SDK ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
106 stars 7 forks source link

Audio randomly cuts off. Webplayer seems to still be playing. #80

Open itsMatoosh opened 5 years ago

itsMatoosh commented 5 years ago

Issue found on 04.08.2019

During playback using the Webplayer SDK, the audio randomly cuts off around once every hour. When the audio stops playing, the web player keeps receiving 'player_state_changed' events, in which the position property is increasing as if the playback was taking place.

The audio is typically off for around 5 minutes and then starts playing again. When the audio starts playing again, a sudden spike in CPU activity can be seen on the profiler as seen on the screenshot below. cpu-spike

While the audio is off, the following activity can be seen on the network profiler in chrome. image As you can see, there are a couple of stalled requests there, all originating from the same place in the index.js script.

Here is the part of the index.js script which is stalling the requests: Przechwytywanie5

The issue occurs in Chrome and Firefox. It occurs in my project, but also in the sdk quickstart source code: https://developer.spotify.com/documentation/web-playback-sdk/quick-start/.

Scope(s):

'streaming',
'user-read-birthdate',
'user-read-email',
'user-read-private',
'user-read-playback-state',
'user-modify-playback-state',
'user-read-currently-playing',
'user-top-read'
itsMatoosh commented 5 years ago

It seems like the SDK is trying to fetch the same audio fragment multiple times when the audio cuts out. Those 'faulty' audio fragments can stall the playback for more than 10 minutes unless the song is skipped manually. Below is an example of an audio fragment which was requested 3 times in my player and each time the request took around 3 minutes to complete.

https://audio-ak-spotify-com.akamaized.net/audio/459508d72d4c10ffd784c4b4213967c774306479?__token__=exp=1565181514~hmac=ce8a59788bf1dceb2a0d679ec930e4891729c8e2e3b5c36529bb004a85ec6989

tobika commented 4 years ago

Hi @itsMatoosh do you have had some progress with this problem?

I also have quite a lot of this problems with my users. Tracks can even be randomly skipped without any indication of errors or playback stops like in your case.

itsMatoosh commented 4 years ago

@tobika, unfortunately, I haven't found a solution to this. I had to switch to Youtube Music because the Spotify Web SDK was just too unreliable.