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 eb66ae5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spotify-web-playback-ts",
"version": "0.0.1",
"version": "0.0.2",
"description": "TypeScript Wrapper of Spotify Playback SDK",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down

0 comments on commit eb66ae5

Please sign in to comment.