Closed nzoschke closed 3 years ago
The error string approach feels fragile, but I don't see a better way. Here's one of the full error events I observed:
{message: "Authentication Error: Browser prevented autoplay due to lack of interaction", name: "", level: 0}
I'm doing a bit more investigation if handling this error is truly necessary.
In my app at least, playback doesn't start without user interaction. So perhaps I can automatically transfer paused playback first, then explicitly start playback with the user interaction.
More research shows that handling this error is necessary. Transferring to the web SDK device doesn't seem to be working outside of playing a track with the SDK. The first play triggers the browser error, a second explicit button press gets the SDK going.
@nzoschke thanks for the fix! Shall we also add an entry in the Readme?
@fotiDim updated the readme, let me know how it sounds.
I also added something to the readme which fixes #100. I could split that out into its own thing if necessary.
Recently the Spotify Web Playback SDK added support for Safari both on iOS and desktop, however these browsers have extra media activation policies that trigger an authentication_error when starting playback.
Before this change, this browser authentication_error error went down the SDK disconnect path making it impossible to recover.
With this change the error is suppressed, allowing us to present a user with a button to call
resume()
and start playback as normal.