<分区>
每当我运行我的程序时,它都会抛出 Illegal instruction: 4 并且我不知道为什么。
我的代码:
glob('/path/music/*.mp3', function(error, files) {
for(var i = 0; i < files.length; i++) {
songs.push(files[i]);
console.log("Added file: " + files[i]);
}
console.log("Init player");
p = new player(songs)
.on('playing', function(song){
console.log("Playing now: " + song._name);
})
.on('playend', function(song){
console.log("Next song....");
})
.on('error', function(song){
console.log("Error:" + error);
}).play();
setTimeout(function(){ p.stop();},5000);
console.log(JSON.stringify(p))
});
所以程序应该从我的路径播放 mp3 文件 5 秒,然后停止,但在播放 5 秒后程序终止,控制台输出为:
> node script.js
Playing now: music.mp3
Illegal instruction: 4
我正在使用来自 npm 的播放器包:https://www.npmjs.com/package/player