【发布时间】:2019-04-13 10:08:42
【问题描述】:
每当我运行我的程序时,它都会抛出非法指令: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
【问题讨论】:
标签: javascript node.js macos npm