Closed prithviraj99 closed 7 years ago
What happens if you specify a player manually?
var player = require('play-sound')({player: "mplayer"})
player.play('foo.mp3', function(err){})
{ [Error: spawn mplayer ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn mplayer', path: 'mplayer', spawnargs: [ './Ipl Trumpet Mix-(FreshMaza.co).mp3' ], cmd: 'mplayer ./Ipl Trumpet Mix-(FreshMaza.co).mp3' }
This is the error i'm getting.
@prithviraj99
Perhaps a stupid question, but did you install mplayer so it was available through the command line.
cmd
> mplayer
should not result in 'mplayer' is not recognized as an internal or external command
. I can reproduce your error by specifying a player that is not available as a command and thus can't be spawned (ENOENT).
A quick Google gave me as first results mplayer binary executables for Windows, which can be used with play-sound
though (and are easy portable), as:
var player = require('play-sound')({player: "/path/to/downloads/mplayer/mplayer.exe"})
player.play('foo.mp3', function(err){})
(cc @shime)
Thanks @verth, closing due to inactivity.
I'm having the same problem. I've followed all of @verth's advice and and get the same ENOENT error @prithviraj99 was having.
Ok, I've found the root cause:
I'm using this on windows and if I have file paths somewhere in the code - it gives ENOENT error.
C:\Windows\Media\chimes.wav
must use double slashes
C:\\Windows\\Media\\chimes.wav
ps. thanks for the package!
@avalanche1 glad you found the solution, closing this again.
How can we stop the audio..It keeps on playing on my node js file.audio.kill() is not working.It says it is not a function
Did you see the last example in the README? https://github.com/shime/play-sound#examples
I have installed mplayer for windows but still its giving this error. [Error: Couldn't find a suitable audio player]