2021-08-17 用node调用本地播放器播放音乐
2021-08-17 本文已影响0人
罗不错
const path = require('path')
const child_process = require('child_process');
let pathStr = path.join("C:/Program Files (x86)/Tencent/QQMusic/QQMusic.exe")
var p = path.join(__dirname, 'foo.mp3')
console.log(p)
var sound = child_process.spawn(pathStr, ["--play-and-exit", p]);
sound.on('exit', function () {
console.log('played');
});