var fs = require('fs');
var lame = require('lame');
var Speaker = require('speaker');
var $stream = fs.createReadStream('sounds/test.mp3').pipe(new lame.Decoder).pipe(new Speaker);
setTimeout(function() {
$stream.close();
}, 5000);
setTimeout(function() {
console.log('It worked!');
}, 10000);
这会产生以下输出。(不是“它起作用了!”正如预期的那样。)有没有办法停止播放音频文件?
node: pcm.c:1951: snd_pcm_bytes_to_frames: Assertion `pcm' failed.
Abgebrochen (Speicherabzug geschrieben)