Rdio JavaScript API with CommonJS Wrappers (Beta)
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.npmignore
Devfile
README.md
index.js
package.json

README.md

rdio-js-api

CommonJS Wrapper for Rdio JavaScript API.

rdio = require('rdio-js-api')('api-key-here', 'auth.html')

rdio.play('artist/Daft_Punk/album/Random_Access_Memories/track/Give_Life_Back_to_Music')

Install

$ npm install rdio-js-api

API

rdio(api-key, path/to/auth.html, callback)

rdio = require('rdio-api')('api-key-here', 'path/to/auth.html')

.play(url, callback)

rdio.play('artist/Daft_Punk/album/Random_Access_Memories/track/Give_Life_Back_to_Music', function () {
  // playing
})

.playFromKey(key)

.pause(song-key)

.onPlay(callback)

.onPause(callback)

.onEnd(callback)

.onPlayStateChange(callback)

rdio.onPlayStateChange(function(){
  rdio.state().playing
  // => true/false
})

request(method, options, callback)

rdio.request('getObjectFromUrl', { url: url }, function (error, track) {
  rdio.playFromKey(track.key)
})

.state() => object

.isPaused() => boolean

.isPlaying() => boolean

.isStopped() => boolean

.ready(callback)

.sdk(callback)

Loads the original Rdio SDK.

rdio.sdk(function (error, sdk) {
  sdk.ready(function () {
    sdk.play({ source: key })
  })
})

Testing

Clone the repo first, and make sure you have all dependencies installed:

$ npm install

And run tests by calling the npm test command:

$ npm test

This will start publishing the tests on :7559. Visit localhost:7559 to run the tests in a browser.