Play audio with Node.JS

前端 未结 7 2094
故里飘歌
故里飘歌 2021-02-01 15:52

I\'m currently using child_process and command-line mplayer to play audio on the local machine, with my Node.JS application. This works, but it\'s not really an exc

7条回答
  •  鱼传尺愫
    2021-02-01 16:39

    Check out sound-play, it's a simple solution that works on Windows and MacOS without using external players:

    const sound = require('sound-play')
    sound.play('music.mp3')
    

    Disclaimer: I'm the author of this package.

提交回复
热议问题