Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhduracell committed Feb 5, 2022
1 parent 78ab718 commit b2fef52
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,34 @@
# Getting started

## Installation
```
```bash
npm i --save spotify-web-playback-ts
```
```

## Usage
```js
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
1. Read the [Spotify Playback SDK Quickstart](https://developer.spotify.com/documentation/web-playback-sdk/quick-start/)
2. Read the [Spotify Playback SDK API reference](https://developer.spotify.com/documentation/web-playback-sdk/reference/#api-spotify-player)
3. See [SpotifyPlayer type insterface](./src/index.ts) for usage

0 comments on commit b2fef52

Please sign in to comment.