1.3.4 • Published 8 years ago

blitzr-js-sdk v1.3.4

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

Blitzr Official Javascript SDK

This client makes it easy to deal with Blitzr API and create player.

To use this client you will need an API key, you can request it at : developer.blitzr.com.

documention API

reference SDK

Install

npm i blitzr-js-sdk --save-dev

Usage

Create a instance and call API

const Blitzr = require('blitzr-js-sdk')

const blitzr = new Blitzr('myAPIKey')

blitzr.search.artist({ query: 'myArtist' }).then(result => {
    // do something whit result
}, err => {
    // error callback
})

You can find the document API here.

Player

The player provides methods to control playlists.

  • load
  • play
  • pause
  • stop
  • seekTo
  • volume

First, create in your html a tag with an id.

<div id="player"></div>

Then create an instance of Player and load a track by UUID

const player = Blitzr.player('player', options)

player.load('uuid')

player.pause()

player.play()

player.seekTo(200) // time in second

player.volume = 50 // volume in percentage

player.currentTime // time of current track in seconds

player.duration // duration of current track in seconds

player.stop()

You can provide options

const options = {
    width: 200, // width of player in px
    height: 200, // height of player in px
    initVolume: 100, // volume initial in percentage
    /* Hooks */
    onPlay(data) {},
    onPlaying(data) {},
    onPause(data) {},
    onLoad() {},
    onSeekTo(time) {}, // time is a new time
    onSetVolume(volume) {}, // volume is a new volume
    onStop() {},
    onEnd(data) {}
};

const player = Blitzr.player('player', options)

In hooks,

  • this is the player instance
  • data is an object provided by iframe

You can get data with hooks :

  • onPlay, it's called on start of each track
  • onPlaying, it's called every second during the play track
  • onEnd, it's call on end of each tracks
{
    status: 'blitzr_playing', // name of event ('blitzr_playing', 'blitzr_paused', 'blitzr_ended')
    time: 0.0, // current time of track in seconds
    duration: 300.181, // duration of track in seconds
    source_provider: 'youtube',
    identifier: 1464170877082 // identifier for iframe of player
}
1.3.4

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago