spotify-web-playback-ts
v0.0.3
Published
TypeScript Wrapper of Spotify Playback SDK
Downloads
9
Maintainers
Readme
Getting started
Installation
npm i --save spotify-web-playback-ts
Usage
async function load() {
const accessToken = '...'
// Init playback SDK by adding async script to document and await load
const player = await SpotifyPlayer.init(document, 'Browser Player!', 0.5, cb => cb(accessToken))
// Connect the player
await player.connect()
// Listen to player state
player.onPlayerStateChanged(state => console.log('State changed', state)
// Toggle playback
await player.togglePlay()
}
load()
Documentation
Read the Spotify Playback SDK Quickstart
Read the Spotify Playback SDK API reference
See SpotifyPlayer type insterface for usage