Not emitting audio received from websocket (webm opus)
I'm trying to make a voice bot PoC that takes browser audio stream (webm opus) and sends it over websocket to be spoken into a channel via the bot. I have the stream working with the website and the server, but the bot is not emitting the audio in the channel. I see the following state transition logs
As you can see the player doesn't change from buffering to playing until 3 minutes later, and it never plays any audio. I can verify that the audio is being received.
Some code:
3 Replies
- What are your intents?
GuildVoiceStates
is required to receive voice data!
- Show what dependencies you are using -- generateDependencyReport()
is exported from @discordjs/voice
.
- Try looking at common examples: https://github.com/discordjs/voice-examples.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!I can see in logs I am getting the data, and I do have the voicestates:
dependencies:
I can also see that the
read
method is only being called once, and not again when I emit the event that it should be called again according to https://nodejs.org/api/stream.html#readablereadsize
my suspicion is that the resource is not getting audio from the Readable, because it sits buffering for so long
I tried using and confirmed that does play audio, so connection is fine
ok so it seems i had to start the discord bot first, then send audio, so the header frame for the audio was sent to discord