Skip to content

Instantly share code, notes, and snippets.

@JMPerez
Created April 21, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JMPerez/a9f7997a19cabe0c7151f3e6247f92d7 to your computer and use it in GitHub Desktop.
Save JMPerez/a9f7997a19cabe0c7151f3e6247f92d7 to your computer and use it in GitHub Desktop.
An example of how to use the spotify-player wrapper
<html>
<body>
<script src="https://spotify-player.herokuapp.com/spotify-player.js"></script>
<script>
var spotifyPlayer = new SpotifyPlayer();
spotifyPlayer.on('update', response => {
// render the track received
});
spotifyPlayer.on('login', user => {
if (user === null) {
// no user
} else {
// say hello to the user, and tell them to play something!
}
});
spotifyPlayer.init();
spotifyPlayer.login();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment