-
Notifications
You must be signed in to change notification settings - Fork 3
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
Can't load <Script> tag? #1
Comments
Hi! I published a new version that fixes the bundling of the package. Unfortunately it seems like the What you can do instead is add a |
@niekert Thank you. |
I couldn't fix it with the provided solution by @niekert either. Now trying to build my own hook based on this repo and this SO solution. Not completely there, but it seems to work so far. |
I haven't had time to update the repo yet with a working version, but I am using a similar hook in one of my projects. You can check here for inspiration on how to inject the spotify script: https://github.com/niekert/FissList/blob/master/packages/client/src/hooks/spotifyWebSdk.tsx |
Also got it working now. Got almost the same setup, but with an authentication prop; React.useEffect(() => {
if (authenticated) {
window.onSpotifyWebPlaybackSDKReady = () => {
playerRef.current = new window.Spotify.Player({
name: 'Spotify Together',
getOAuthToken: (cb) => {
console.log('accessToken', localStorage.getItem('accessToken'));
const token = localStorage.getItem('accessToken');
cb(token);
},
});
setIsReady(true);
};
}
if (!window.Spotify) {
const scriptTag = document.createElement('script');
scriptTag.src = 'https://sdk.scdn.co/spotify-player.js';
document.head.appendChild(scriptTag);
}
}, [authenticated]); |
Hi,
I get the following error after using your package.
My Root file is as followed:
My Webpack has the following loaders:
Any idea what's the issue?
The text was updated successfully, but these errors were encountered: