mirror of
https://github.com/wahyd4/play-sound.git
synced 2026-08-09 04:46:23 +10:00
start with this
This commit is contained in:
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -0,0 +1,9 @@
|
||||
function Play(opts){
|
||||
this.child_process = opts.child_process
|
||||
this.play = function(what){
|
||||
if (what) this.child_process.exec('cvlc ' + what)
|
||||
}
|
||||
}
|
||||
module.exports = function(opts){
|
||||
return new Play(opts)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "play-sound",
|
||||
"version": "0.0.0",
|
||||
"description": "Play audio files by shelling out to available audio tool.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node_modules/.bin/mocha tests.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/shime/play-sound.git"
|
||||
},
|
||||
"keywords": [
|
||||
"audio",
|
||||
"sound",
|
||||
"play"
|
||||
],
|
||||
"author": "Hrvoje Simic <shime.ferovac@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/shime/play-sound/issues"
|
||||
},
|
||||
"homepage": "https://github.com/shime/play-sound",
|
||||
"devDependencies": {
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^1.21.4",
|
||||
"sinon": "^1.10.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
var expect = require('expect.js')
|
||||
, sinon = require('sinon')
|
||||
|
||||
|
||||
describe('cvlc has the maximum priorty', function(){
|
||||
it('tries to play with cvlc first', function(){
|
||||
var command = "cvlc beep.mp3"
|
||||
, spy = sinon.spy()
|
||||
|
||||
var cli = require('./')({ child_process: {
|
||||
exec: spy
|
||||
}})
|
||||
|
||||
cli.play('beep.mp3')
|
||||
|
||||
expect(spy.calledOnce).to.be(true)
|
||||
expect(spy.calledWith(command)).to.be(true)
|
||||
})
|
||||
|
||||
it("doesn't try to play anything if nothing is passed", function(){
|
||||
var command = "cvlc beep.mp3"
|
||||
, spy = sinon.spy()
|
||||
|
||||
var cli = require('./')({ child_process: spy})
|
||||
cli.play()
|
||||
|
||||
expect(spy.called).to.not.be(true)
|
||||
})
|
||||
|
||||
it("doesn't error out if it's not available")
|
||||
})
|
||||
|
||||
it('fallbacks to other players')
|
||||
|
||||
describe('errors', function(){
|
||||
})
|
||||
Reference in New Issue
Block a user