Discord js Voice: error on play small audios #10139
Replies: 2 comments
-
|
Hmm |
Beta Was this translation helpful? Give feedback.
-
|
It seems like you're encountering a common issue with short audio buffers on cloud environments like AWS EC2. This usually happens because the UDP packet stream doesn't have enough time to stabilize before the audio resource ends, or due to resource throttling on T2/T3 instances. Here are a few things you can try to resolve this: Enable Inline Volume: Even if you don't change the volume, enabling inlineVolume forces the resource to be processed through a transformer, which sometimes helps in stabilizing the stream timing for very short files. const resource = createAudioResource(yourSource, { inlineVolume: true });Pre-buffer/Silence Padding: Try adding 50-100ms of silence to the beginning and end of your 1-2s audio clips. This ensures that the voice connection is fully 'warm' before the actual audio data starts hitting the Discord gateway. Check UDP Keep-Alive: On Ubuntu/EC2, ensure your security groups allow all outbound UDP traffic. Sometimes, slight packet loss on cloud instances causes short bursts of audio to be dropped entirely. AudioPlayer State Check: Make sure you aren't calling connection.destroy() or player.stop() too aggressively. Use the AudioPlayerStatus.Idle event listener to wait properly before disconnecting. Hope this helps! If this fixes your issue on EC2, please let us know. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Which package is this bug report for?
voice
Issue description
Discord js Voice: error on play small audios.
I've been trying to play short audio on the call (1-2 seconds), but the audio doesn't play in full correctly, or it cuts in half, or it doesn't play at all. On my Windows machine it is perfect, but within EC2 things get complicated.
Code sample
No response
Versions
Issue priority
Low (slightly annoying)
Which partials do you have configured?
GuildMember
Which gateway intents are you subscribing to?
Guilds
I have tested this issue on a development release
No response
Beta Was this translation helpful? Give feedback.
All reactions