spotify / spotify-web-playback-sdk-example

React based example app that creates a new player in Spotify Connect to play music from in the browse using Spotify Web Playback SDK.
Apache License 2.0
152 stars 206 forks source link

Spotify web playback sdk doesn't work with React 18 #11

Open joceqo opened 1 year ago

joceqo commented 1 year ago

Well i was trying to implement spotify web sdk on react 18 ( with next 13 and others recent package). i spent an afternoon trying to debug error like

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://sdk.scdn.co') does not match the recipient window's origin ...

and this one https://stackoverflow.com/questions/76097035/spotify-sdk-throwing-this-streamer-is-null-error-when-trying-to-play-or-skip/76283570#76283570

in the end i found that the sdk doesn't work with React 18

cameronb23 commented 11 months ago

Just had to work in this myself. Found a fix and posted on StackOverflow - Spotify should still fix this, but in the meantime I believe my fix works.