Having an issue with my bot playing an mp3 file. It successfully joins the voice chat and starts playing, but there is no audio output. The bot icon lights up green indicating it's playing, but no sound is heard.
Here's the code snippet:
await entersState(voiceConn, VoiceConnectionStatus.Ready, 10e3)
const player = createAudioPlayer()
player.on('debug', m => {
console.log(m)
})
player.on('error', error => {
console.error(`Error: ${error}`)
})
const resource = createAudioResource(join(__dirname, '../../songs/song.mp3'))
player.play(resource)
player.on(AudioPlayerStatus.Playing, () => {
console.log('Now playing')
})
voiceConn.subscribe(player)
await interaction.followUp('Playing!')
await entersState(player, AudioPlayerStatus.Idle, 10e3)
voiceConn.destroy()
Here's the log from the player:
from {"status":"idle","resource":false,"stepTimeout":false}
to {"status":"buffering","resource":true,"stepTimeout":false}
Now playing
state change:
from {"status":"buffering","resource":true,"stepTimeout":false}
to {"status":"playing","missedFrames":0,"playbackDuration":0,"resource":true,"stepTimeout":false}
state change:
from {"status":"playing","missedFrames":0,"playbackDuration":8700,"resource":true,"stepTimeout":false}
to {"status":"idle","resource":false,"stepTimeout":false}