-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
127 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ node_modules | |
.DS_* | ||
npm-debug.* | ||
*.sublime* | ||
thumb | ||
thumb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,49 @@ | ||
var Player = require('../index'); | ||
var pkg = require('../package.json'); | ||
var debug = require('debug')(pkg.name); | ||
|
||
var player = new Player([ | ||
__dirname + '/demo.mp3' | ||
]); | ||
|
||
player.play(function(err) { | ||
console.log('all songs play end'); | ||
debug('all songs play end'); | ||
}); | ||
|
||
player.on('downloading', function(song) { | ||
console.log('im downloading... '); | ||
console.log(song); | ||
debug('I\'m downloading... '); | ||
debug(song); | ||
}); | ||
|
||
player.on('playing', function(song) { | ||
console.log('im playing... '); | ||
console.log(song); | ||
console.log('add new song'); | ||
if (song._id === 0) { | ||
|
||
debug('I\'m playing... '); | ||
debug(song); | ||
debug('Add new song'); | ||
|
||
if (song._id === 0) | ||
player.add('http://node-player.qiniudn.com/demo2.mp3'); | ||
} | ||
console.log('and I\'ll switch to next song in 3s:'); | ||
|
||
debug('Will switch to next song in 3s:'); | ||
|
||
setTimeout(function(){ | ||
console.log('switch now !'); | ||
debug('Switching...'); | ||
|
||
player.next(function(err, song){ | ||
if (!err) return console.log('switched !!'); | ||
return console.log(err); | ||
if (!err) | ||
return debug('Switched !!'); | ||
|
||
return debug(err); | ||
}); | ||
|
||
}, 3000); | ||
}); | ||
|
||
player.on('playend', function(song) { | ||
console.log('play done, switching to next one ...'); | ||
debug('play done, switching to next one ...'); | ||
}); | ||
|
||
player.on('error', function(err) { | ||
console.log('Opps...!') | ||
console.log(err); | ||
}); | ||
debug('Opps...!') | ||
debug(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
var Player = require('../index'); | ||
var pkg = require('../package.json'); | ||
var debug = require('debug')(pkg.name); | ||
|
||
var player = new Player([ | ||
__dirname + '/demo.mp3', | ||
__dirname + '/demo2.mp3' | ||
]); | ||
|
||
player.play(function(err) { | ||
console.log('all songs play end'); | ||
debug('All songs play end'); | ||
}); | ||
|
||
player.on('playing', function(song) { | ||
console.log('im playing... '); | ||
console.log(song); | ||
debug('I\'m playing... '); | ||
debug(song); | ||
}); | ||
|
||
player.on('playend', function(song) { | ||
console.log('play done, switching to next one ...'); | ||
debug('Play done, Switching to next one ...'); | ||
}); | ||
|
||
player.on('error', function(err) { | ||
console.log('Opps...!') | ||
console.log(err); | ||
}); | ||
debug('Opps...!') | ||
debug(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
var Player = require('../index'); | ||
var pkg = require('../package.json'); | ||
var debug = require('debug')(pkg.name); | ||
|
||
var player = new Player([ | ||
'http://node-player.qiniudn.com/demo.mp3', | ||
'http://node-player.qiniudn.com/demo2.mp3' | ||
]); | ||
|
||
player.play(function(err) { | ||
console.log('all songs play end'); | ||
debug('all songs play end'); | ||
}); | ||
|
||
player.on('downloading', function(song) { | ||
console.log('im downloading... '); | ||
console.log(song); | ||
debug('im downloading... '); | ||
debug(song); | ||
}); | ||
|
||
player.on('playing', function(song) { | ||
console.log('im playing... '); | ||
console.log(song); | ||
debug('im playing... '); | ||
debug(song); | ||
}); | ||
|
||
player.on('playend', function(song) { | ||
console.log('play done, switching to next one ...'); | ||
debug('play done, switching to next one ...'); | ||
}); | ||
|
||
player.on('error', function(err) { | ||
console.log('Opps...!') | ||
console.log(err); | ||
}); | ||
debug('Opps...!') | ||
debug(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
var Player = require('../index'); | ||
var pkg = require('../package.json'); | ||
var debug = require('debug')(pkg.name); | ||
|
||
var player = new Player([ | ||
__dirname + '/demo.mp3', | ||
__dirname + '/demo2.mp3' | ||
]); | ||
|
||
console.log("Play List:" + player.playList()); | ||
debug("Play List:" + player.playList()); | ||
|
||
player.play(function(err) { | ||
console.log('all songs play end'); | ||
console.log("Play List End:" + player.playList()); | ||
debug('all songs play end'); | ||
debug("Play List End:" + player.playList()); | ||
}); | ||
|
||
player.on('playend', function(song) { | ||
console.log("Play List After Song Played:" + player.playList()); | ||
debug("Play List After Song Played:" + player.playList()); | ||
}); | ||
|
||
player.on('error', function(err) { | ||
console.log('Opps...!') | ||
console.log(err); | ||
debug('Opps...!') | ||
debug(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
var Player = require('../index'); | ||
var pkg = require('../package.json'); | ||
var debug = require('debug')(pkg.name); | ||
|
||
var player = new Player([ | ||
__dirname + '/demo.mp3', | ||
__dirname + '/demo2.mp3' | ||
]); | ||
|
||
player.play(function(err) { | ||
console.log('all songs play end'); | ||
debug('all songs play end'); | ||
}); | ||
|
||
player.on('playing', function(song) { | ||
console.log('im playing... '); | ||
console.log(song); | ||
debug('im playing... '); | ||
debug(song); | ||
|
||
if (song._id > 0) { | ||
console.log('and I\'ll stop in 5s:'); | ||
debug('and I\'ll stop in 5s:'); | ||
|
||
setTimeout(function(){ | ||
console.log('stopped now !'); | ||
debug('stopped now !'); | ||
player.stop(); | ||
}, 5000); | ||
} | ||
}); | ||
|
||
player.on('playend', function(song) { | ||
console.log('play done, switching to next one ...'); | ||
debug('play done, switching to next one ...'); | ||
}); | ||
|
||
player.on('error', function(err) { | ||
console.log('Opps...!') | ||
console.log(err); | ||
}); | ||
debug('Opps...!') | ||
debug(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
var Player = require('../index'); | ||
var pkg = require('../package.json'); | ||
var debug = require('debug')(pkg.name); | ||
|
||
var player = new Player([ | ||
__dirname + '/demo.mp3', | ||
__dirname + '/demo2.mp3' | ||
]); | ||
|
||
player.play(function(err) { | ||
console.log('all songs play end'); | ||
debug('all songs play end'); | ||
}); | ||
|
||
player.on('playing', function(song) { | ||
console.log('im playing... '); | ||
console.log(song); | ||
console.log('and I\'ll stop in 5s:'); | ||
debug('im playing... '); | ||
debug(song); | ||
debug('and I\'ll stop in 5s:'); | ||
|
||
setTimeout(function(){ | ||
console.log('stopped now !'); | ||
debug('stopped now !'); | ||
player.stop(); | ||
}, 5000) | ||
}); | ||
|
||
player.on('playend', function(song) { | ||
console.log('play done, switching to next one ...'); | ||
debug('play done, switching to next one ...'); | ||
}); | ||
|
||
player.on('error', function(err) { | ||
console.log('Opps...!') | ||
console.log(err); | ||
}); | ||
debug('Opps...!') | ||
debug(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
* @Created: [2013/07/20] | ||
* | ||
**/ | ||
* | ||
|
||
module.exports = require('./libs/player'); |
Oops, something went wrong.