Closed insign closed 2 years ago
const Audic = require("audic")
const player = new Audic("ready.wav")
player.play()
setTimeout(() => {
player.destroy()
}, player.duration)
C:\Users\helio\MEGA\WORK\simpleads\easycontent\frontend\node_modules\audic\dist\index.js:118
this._vlc.kill();
^
TypeError: Cannot read property 'kill' of undefined
at Audic.destroy (C:\Users\helio\MEGA\WORK\simpleads\easycontent\frontend\node_modules\audic\dist\index.js:118:19)
at Timeout._onTimeout (C:\Users\helio\MEGA\WORK\simpleads\easycontent\frontend\ready.js:6:10)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Ah. We've got to wait for the instance to start:
const Audic = require("audic")
const player = new Audic("ready.wav")
await player.play()
setTimeout(() => {
player.destroy()
}, player.duration)
player.duration
simply gives me "undefined" when printed, and 0 when looking at the printed object. Both for .mp3 and .wav. I do await player.play()
@Wyrtz Are you able to hear the audio play?
I tried , but I was not able to hear the audio play
The file is played but never ends on the CLI.
To Reproduce ready.js
node ready.js
plays but never exits the script.To fix this I need to add:
setTimeout(() => process.exit(), 2000)
2000 means the time to play my audio file.