soundcloud-audio
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "soundcloud-audio", | ||
"main": "dist/soundcloud-audio.js", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/voronianski/soundcloud-audio.js", | ||
@@ -6,0 +6,0 @@ "description": "Play SoundCloud tracks and playslists in modern browsers with HTML5 Audio API", |
26
index.js
@@ -12,2 +12,4 @@ 'use strict'; | ||
this._events = {}; | ||
this._clientId = clientId; | ||
@@ -58,10 +60,26 @@ this._baseUrl = 'http://api.soundcloud.com'; | ||
SoundCloud.prototype.on = function (e, callback) { | ||
this.audio.addEventListener(e, callback, false); | ||
SoundCloud.prototype.on = function (e, fn) { | ||
this._events[e] = fn; | ||
this.audio.addEventListener(e, fn, false); | ||
}; | ||
SoundCloud.prototype.off = function (e, callback) { | ||
this.audio.removeEventListener(e, callback); | ||
SoundCloud.prototype.off = function (e, fn) { | ||
this._events[e] = null; | ||
this.audio.removeEventListener(e, fn); | ||
}; | ||
SoundCloud.prototype.unbindAll = function () { | ||
for (var e in this._events) { | ||
var fn = this._events[e]; | ||
if (fn) { | ||
this.off(e, fn); | ||
} | ||
} | ||
}; | ||
SoundCloud.prototype.preload = function (streamUrl) { | ||
this._track = {stream_url: streamUrl}; | ||
this.audio.src = streamUrl+'?client_id='+this._clientId; | ||
}; | ||
SoundCloud.prototype.play = function (options) { | ||
@@ -68,0 +86,0 @@ options = options || {}; |
{ | ||
"name": "soundcloud-audio", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Play SoundCloud tracks and playslists in modern browsers with HTML5 Audio API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -54,5 +54,5 @@ # <img src="http://www.officialpsds.com/images/thumbs/Soundcloud-Logo-psd47614.png" width="75" align="left"> soundcloud-audio.js | ||
// e.g. we do it here when playing track is finished | ||
scPlayer.onAudioEnded = function () { | ||
scPlayer.on('ended', function () { | ||
scPlayer.next(); | ||
}; | ||
}); | ||
@@ -86,2 +86,6 @@ // play specific track from playlist by it's index | ||
#### `preload(streamUrl)` | ||
Preloads track data without playing it. | ||
#### `pause()` | ||
@@ -125,2 +129,4 @@ | ||
#### `unbindAll()` | ||
```javascript | ||
@@ -127,0 +133,0 @@ var SoundCloudAudio = require('soundcloud-audio'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13967
143
165