Audio stops playing

Yeah, it's another one of these posts and at this point I've pretty much lost all patience with this broken library. The issue is that, after joining a voice channel and beginning to stream audio (from an arbitrary URL source) for a bit, the bot will stop producing any sound and appears to have stopped transmitting audio to discord altogether (based on Network Activity dropping to nil). That's not the worse part. discordjs/voice lib does not produce any output to voice connection debug or stateChange event listeners when this happen. See: https://discordjs.dev/docs/packages/voice/0.11.0/VoiceConnection:Class#on It also produces no output to audio player stateChange event listeners when it happens. See: https://discordjs.dev/docs/packages/voice/0.11.0/AudioPlayer:Class#on Basically, discordjs/voice stops playing audio and doesn't give so much as a whisper as to why. No errors. Nothing. Looking around this Discord, it seems loads of people are experiencing these issues, yet we have gotten no updates, fixes or information about works towards a resolution. My question is this: What are the plans for the future of discordjs/voice? Is it still being actively maintained and are there plans to iron out all the issues existing in it's current state? Or should I avoid wasting any more of my time trying to debug, and hack around, these issues?
voice | VoiceConnection
A connection to the voice server of a Guild, can be used to play audio in voice channels.
voice | AudioPlayer
Used to play audio resources (i.e. tracks, streams) to voice connections.
29 Replies
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
Version Info:
discord.js - 14.3.0,
@discordjs/voice - 0.14.0
libsodium-wrappers - 0.7.10
ffmpeg-static - 5.1.0
Node - 16.17.0
discord.js - 14.3.0,
@discordjs/voice - 0.14.0
libsodium-wrappers - 0.7.10
ffmpeg-static - 5.1.0
Node - 16.17.0
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
I've played around with it some more, and have managed to get somewhat meaningful info out of VoiceConnection's statusChange event listener. Sseems to be hit/miss on whether it decides to actually emit but when it does it appears the VoiceConnection enters signalling state and stays there indefinitely:
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
I guess a 'hack' would be to watch for when this happens and recreate the VoiceConnection, but the problem is exactly that: it's a hack not a fix. Similiarly to how every other issue with this lib has to be handled.
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
oh man, I have to give kudos to everyone in that thread diving into, and debugging, the source itself. Looks like hell to sift through all that. Bonus kudos to you, vittee, for finding that extra tidbid about server region. Since this sounds like a Discord issue, I'm wondering if they're aware of it?
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
Brad
Bradā€¢2y ago
For me at least it's working but is definitely stuttering through it at moments.
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
I must say, I was excited when I heard the news for the bug fixes this morning but I can also confirm the latest release has not fixed the issue. In fact, it's somehow made it worse. The amount of time before the voice connection dies/stops playing seems to have changed. Previously it was consistently <1 minute. Now it can take more than 5 minutes or less than 10 seconds - there is no consistency. Previously, having the bot leave, and rejoin, the channel would be a quick fix to get audio playing again. With the latest release, the bot still will not play after rejoining and creating a new voice connection. A bot restart is required in this situation to get it going again (in that guild) Some other things I have noticed with the latest update: - the connection never changes state. Previously it would end up in signalling and stay there indefinitely. Now, the stateChange event never emits and it just remains in it's ready state from when it first joined the channel. - the bot doesn't disconnect from the voice channel. Previously, when audio stopped playing, the bot would eventually disconnect from the channel. Now, it'll just sit there silently.
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
As per my first/original message in this thread, debug and stateChange events weren't emitting anything in these situations. Can give it another go now (since I'm now on 0.15) but I'm not sure how much luck it'll have. Yea @qjuh, the debug event isn't being emitted, period Here's how I'm creating the voice connection:
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
});

connection.on('debug', console.log);

connection.subscribe(player);
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
});

connection.on('debug', console.log);

connection.subscribe(player);
oo, that's interesting. Would not have picked that up from the docs. Could be worth mentioning it in the debug event listeners's section šŸ§ now that debug is enabled it ain't gonna do it :feelsbanhammer: Ok, this is actually unironically working fine now after running the bot with debug enabled. Even subsequent runs without debug enabled are still working fine. I dont know what dark magic is going on behind the scenes but yea.... before I used the debug, it'd consistently stop playing, everytime. But now I can't seem to get it to fail at all. Very weird. šŸ‘ yup, fair enough. I'll keep an eye on it and see how it goes. Really was hoping to see some juicy message/info on exactly why it was stopping and now I feel kinda robbed šŸ˜” but at least it is working for now.. Should I close this post? Pretty new to this Discord feature. Is it possible to re-open it later, if required?
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
Oop, nvm, I've got a failure. Here is the part of the log where audio stopped playing and did not resume:
[2023:03:16 00:39:45:426] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":3,"d":1678889385426} // .. ..
[2023:03:16 00:39:45:487] [INFO]: [VOICE DEBUG]: [NW] [WS] << {"op":6,"d":1678889385426} // .. These go on and on above
[2023:03:16 00:39:59:179] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":3,"d":1678889399179}
[2023:03:16 00:39:59:235] [INFO]: [VOICE DEBUG]: [NW] [WS] << {"op":6,"d":1678889399179}
[2023:03:16 00:40:07:649] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":5,"d":{"speaking":0,"delay":0,"ssrc":619208}}
[2023:03:16 00:40:12:933] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":3,"d":1678889412933}
[2023:03:16 00:40:13:088] [INFO]: [VOICE DEBUG]: [NW] [WS] << {"op":6,"d":1678889412933}
[2023:03:16 00:39:45:426] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":3,"d":1678889385426} // .. ..
[2023:03:16 00:39:45:487] [INFO]: [VOICE DEBUG]: [NW] [WS] << {"op":6,"d":1678889385426} // .. These go on and on above
[2023:03:16 00:39:59:179] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":3,"d":1678889399179}
[2023:03:16 00:39:59:235] [INFO]: [VOICE DEBUG]: [NW] [WS] << {"op":6,"d":1678889399179}
[2023:03:16 00:40:07:649] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":5,"d":{"speaking":0,"delay":0,"ssrc":619208}}
[2023:03:16 00:40:12:933] [INFO]: [VOICE DEBUG]: [NW] [WS] >> {"op":3,"d":1678889412933}
[2023:03:16 00:40:13:088] [INFO]: [VOICE DEBUG]: [NW] [WS] << {"op":6,"d":1678889412933}
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
Here's the full log:
xubby
xubbyā€¢2y ago
Same issue too! It just randomly stops and when you make it rejoin, it just suddenly works šŸ¤” here's what I got from the debug event:
state change:
from {"status":"idle","resource":false,"stepTimeout":false}
to {"status":"buffering","resource":true,"stepTimeout":false}
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":0,"resource":true,"stepTimeout":false}
to {"status":"autopaused","missedFrames":0,"playbackDuration":0,"resource":true,"silencePacketsRemaining":5,"stepTimeout":false}
state change:
from {"status":"autopaused","missedFrames":0,"playbackDuration":100,"resource":true,"silencePacketsRemaining":0,"stepTimeout":false}
to {"status":"playing","missedFrames":0,"playbackDuration":100,"resource":true,"silencePacketsRemaining":0,"stepTimeout":false}
state change:
from {"status":"playing","missedFrames":0,"playbackDuration":60000,"resource":true,"silencePacketsRemaining":0,"stepTimeout":false}
to {"status":"autopaused","missedFrames":0,"playbackDuration":60000,"resource":true,"silencePacketsRemaining":5,"stepTimeout":false}
state change:
from {"status":"idle","resource":false,"stepTimeout":false}
to {"status":"buffering","resource":true,"stepTimeout":false}
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":0,"resource":true,"stepTimeout":false}
to {"status":"autopaused","missedFrames":0,"playbackDuration":0,"resource":true,"silencePacketsRemaining":5,"stepTimeout":false}
state change:
from {"status":"autopaused","missedFrames":0,"playbackDuration":100,"resource":true,"silencePacketsRemaining":0,"stepTimeout":false}
to {"status":"playing","missedFrames":0,"playbackDuration":100,"resource":true,"silencePacketsRemaining":0,"stepTimeout":false}
state change:
from {"status":"playing","missedFrames":0,"playbackDuration":60000,"resource":true,"silencePacketsRemaining":0,"stepTimeout":false}
to {"status":"autopaused","missedFrames":0,"playbackDuration":60000,"resource":true,"silencePacketsRemaining":5,"stepTimeout":false}
where it had playbackDuration of 60000 was when it stopped playing on 0.14.0 was there a new release? so I have to manually uninstall only the voice package, isn't? ohh ok lemme give it a shot npm update @discordjs/voice doesn't do anything tho
Verza@
ā””ā”€ā”€ @discordjs/voice@0.14.0
Verza@
ā””ā”€ā”€ @discordjs/voice@0.14.0
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
Try adding @ileast onto the dependency. Sometimes npm can have some wacky caching behaviour Even still though, the issues are present in 0.15 Whoops. Rip the person named latest šŸ˜³
xubby
xubbyā€¢2y ago
FeelsBadMan did npm update @discordjs/voice@latest and still nothing šŸ„¹
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
šŸ˜® Try npm cache clean --force to clear cache Then npm cache verify to make sure everything checks out no errors. Then npm install discordjs/voice@latest to install the latest version If it still slaps in the old version then your node install is smokin' something šŸ‘€ At that point, could try manually editing the package.json file to 0.15.0, then run npm install and see if it finds it then
xubby
xubbyā€¢2y ago
meguFace still same issue. I guess I should just manually install it
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
what the... What node (node --version) and npm (npm --version) version you on? Because that's super gunky behaviour.
xubby
xubbyā€¢2y ago
node: v18.8.0
npm: 8.18.0
node: v18.8.0
npm: 8.18.0
somehow the new update fixed it šŸ¤ž
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
oo that's good news. Strangely I also noticed latest version somewhat fixed it in prod environment but voice connections were still randomly stopping here and there, albeit a lot less frequently. Running locally, however, completely unstable.
xubby
xubbyā€¢2y ago
haven't test on production and yet it still makes me go crazy welp.. the issue arose again meguFace
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
xubby
xubbyā€¢2y ago
huh?
D3V1L0M3N
D3V1L0M3NOPā€¢2y ago
waitWhat
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
xubby
xubbyā€¢2y ago
some of use don't use ytdl plus that is against YT ToS. you should know by now
Want results from more Discord servers?
Add your server