Error connecting to voice on Raspberry Pi
See original GitHub issueI haven’t had time to test this on another Linux device yet, but I know my code works fine on Windows.
When my bot tries to connect to voice, although actually connecting to the channel succeeds, opening the audio connection fails.
The following error occurs:
java.lang.NullPointerException
at net.dv8tion.jda.audio.AudioWebSocket.send(AudioWebSocket.java:110)
at net.dv8tion.jda.audio.AudioWebSocket.onConnected(AudioWebSocket.java:124)
at com.neovisionaries.ws.client.ListenerManager.callOnConnected(ListenerManager.java:189)
at com.neovisionaries.ws.client.WebSocket.callOnConnectedIfNotYet(WebSocket.java:3207)
at com.neovisionaries.ws.client.WebSocket.onReadingThreadStarted(WebSocket.java:3152)
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:80)
at com.neovisionaries.ws.client.ReadingThread.run(ReadingThread.java:61)
Exception in thread "Thread-5" Exception in thread "Thread-6" java.lang.NullPointerException
at net.dv8tion.jda.audio.AudioConnection$3.run(AudioConnection.java:224)
java.lang.NullPointerException
at net.dv8tion.jda.audio.AudioConnection$2.run(AudioConnection.java:151)
Other than that, I’d like to say that this API is brilliant and really easy to use, so thanks for all the hard work.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Bluetooth PulseAudio problem- please help.
Hi, I've got a got Raspberry Pi in my van, it used to connect up via bluetooth to radio system so I could...
Read more >How to Make your Raspberry Pi Speak Out Loud: Give It a Voice!
Give your Raspberry Pi a voice. In this tutorial we show how to make your Raspberry Pi Speak out loud and say simple...
Read more >Voice Recognition Raspberry PI and Arduino UART ...
High quality PCB prototypes: https://www.pcbway.com3D & CNC service: https://www.pcbway.com/rapid-prototyping/ Recognise voice with ...
Read more >Raspberry Pi Quick Start Guide | Alexa Voice Service
Complete the following step-by-step instructions to set up the Alexa Smart Screen SDK on a Raspberry Pi running Debian Buster. The instructions guide...
Read more >Raspberry Pi Alexa: Build your own Amazon Echo
This screen is the area that will allow us to set up access for our Raspberry Pi to connect to the Alexa voice...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Going to assume this fixes the problem for both parties. @FrozenDroid If the problem persists for you please reopen this issue.
https://github.com/DV8FromTheWorld/JDA/commit/329b3e231db43a14057d62e31a77240f75ea94c4 A race condition like I thought. Basically, the
onConnect
method was being called during theconnect()
method’s execution. Connect runs in the thread it is called from, but theonConnect
method is handled by the websocket thread, which is a different thread. This means that theonConnect
can be executed beforeconnect()
returns. We were using the return fromconnect()
to populate oursocket
variable which is used in thesend(String)
method. So, sinceconnect()
hadn’t returned, using thesocket
variable, which was still null, was throwing an NPE.I changed it so that we set the
socket
variable before attempting to connect. We had the same problem with the Main WebSocket, this specific race condition. However, it was a LOOONG time ago, so I guess I forgot to implement the fix in the AudioWebSocket when I created it.