Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnected from voice server after a few seconds of connection #12

Closed
hmes98318 opened this issue Mar 2, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@hmes98318
Copy link
Owner

hmes98318 commented Mar 2, 2023

Describe the bug
Connecting to certain voice servers in specific regions causes the connection to crash every minute.
It seems to be a Discord issue at the moment.

discordjs/discord.js#9185

A workaround is to remove keepAlive timer/interval..
Add the following code to node_modules/discord-player/dist/VoiceInterface/VoiceUtils.js

// line 43
conn.on('stateChange', (old_state, new_state) => {
            const oldNetworking = Reflect.get(old_state, 'networking');
            const newNetworking = Reflect.get(new_state, 'networking');

            const networkStateChangeHandler = (oldNetworkState, newNetworkState) => {
                const newUdp = Reflect.get(newNetworkState, 'udp');
                clearInterval(newUdp?.keepAliveInterval);
            }

            oldNetworking?.off('stateChange', networkStateChangeHandler);
            newNetworking?.on('stateChange', networkStateChangeHandler);
        });

Screenshots
image

Version Information:

  • Node.js: 18.14.2
  • Discord.js: 14.7.1
  • Music-Disc: 1.2.6
  • Dependency modules
    • discord-player: 5.3.2
    • ffmpeg-static: 5.1.0
    • opusscript: 0.0.8
@hmes98318 hmes98318 added the bug Something isn't working label Mar 2, 2023
@hmes98318
Copy link
Owner Author

@hmes98318
Copy link
Owner Author

v1.2.7 sloved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant