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ā¢2y ago
Message Not Public
Sign In & Join Server To View
Version Info:
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: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ā¢2y ago
Message Not Public
Sign In & Join Server To View
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ā¢2y ago
Message Not Public
Sign In & Join Server To View
For me at least it's working but is definitely stuttering through it at moments.
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
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ā¢2y ago
Message Not Public
Sign In & Join Server To View
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:
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ā¢2y ago
Message Not Public
Sign In & Join Server To View
Oop, nvm, I've got a failure. Here is the part of the log where audio stopped playing and did not resume:
Here's the full log:
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:
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
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 š³
did
npm update @discordjs/voice@latest
and still nothing š„¹š® 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 still same issue. I guess I should just manually install it
what the...
What node (
node --version
) and npm (npm --version
) version you on? Because that's super gunky behaviour.
somehow the new update fixed it š¤
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.
haven't test on production and yet it still makes me go crazy
welp.. the issue arose again
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
huh?
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
some of use don't use ytdl plus that is against YT ToS. you should know by now