0
I’m trying to use a library called steal:
const Troubadour = require('troubadour');
const troubadour = new Troubadour('sox');
app.get('/playmusics', function(req, res){
troubadour.on('start', () => {
// Do something here when the audio starts playing
console.log('Começou');
});
troubadour.on('end', () => {
// Do something here when the audio finishes playing
console.log('Finalizado');
});
troubadour.play(__dirname+'/assets/musics/infiel.mp3');
troubadour.on('error', (error) => {
// Do something here to handle the errors
console.log('Erro :( : ', error);
});
});
But when I enter the URL /playmusics
the server drops and returns me the error in the terminal:
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn play ENOENT
at exports._errnoException (util.js:1026:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
I don’t know what it could be, because I’ve tried it in many ways and nothing works.
Have you tried to isolate the mistake to find out what’s causing it? If you comment on the Troubadour.play line(__dirname+'/Assets/musics/infiel.mp3'); the error remains?
– André
@André when I remove no error, the page in the browser is as if it had only been loading, but shows no error.
– Alisson Acioli