Audio is not received unless audio is being sent
See original GitHub issueGeneral Troubleshooting
- I have checked for similar issues.
- I have updated to the latest JDA version.
- I have checked the branches or the maintainers’ PRs for upcoming features/bug fixes.
Issue
Issue Type
- Bug Report
- Feature Request
Description
Until 9/27/18, AudioReceiveHandler#handleCombinedAudio has been receiving all audio from the connected voice channel. After that date, the function has been writing blank data to the recording file, with 0 changes from me.
AudioReceiveHandler:
//user, warned, updated, channel, and file are defined. close() returns a File object.
@Override
public void handleCombinedAudio(CombinedAudio arg0) {
try {
left = limit - used;
if(updated && warned) {
channel.sendMessage(user.getAsMention() + " Recording termination canceled, you deleted a recording.").queue();
warned = false;
updated = false;
}
if(left < 1024*1024*10 && !warned) {
warned = true;
channel.sendMessage(user.getAsMention() + " Warning, you have less than 10 MB of space left (roughly a minute of recording time). The recording will stop if you do not free up some space.").queue();
}
if(left <= 0) {
closed = true;
channel.sendMessage(user.getAsMention() + " You ran out of space! The recording has been stopped (Recording ID: " + close().getName() + ").\n"
+ "Get more space by deleting some recordings or buying the Monthly Donor role. Details with the `donate` command.").queue();
return;
}
byte[] bytes = arg0.getAudioData(1.0);
if(!closed){
zipStream.write(bytes);
used += bytes.length;
}
} catch (IOException e) {
e.printStackTrace();
closed = true;
}
}
If I send this data back to Discord in my AudioSendHandler (which worked fine until the mentioned date), I can’t hear anything.
AudioSendHandler:
//channel and BUFFSIZE are defined. BUFFSIZE = 3840
@Override
public byte[] provide20MsAudio() {
byte[] bytes = new byte[BUFFSIZE];
try {
int readBytes = stream.read(bytes, 0, BUFFSIZE);
if(readBytes < 1) {
closed = true;
close();
channel.sendMessage("Recording playback ended").queue();
return bytes;
}
//I'm reading from a FileInputStream from a zipped file. Occasionally, the unzipping process takes longer than 20ms. Better to block until we actually have data than sending what we have and facing the wrath of the opus decoder.
while(readBytes < BUFFSIZE){
readBytes += stream.read(bytes, readBytes, BUFFSIZE - readBytes);
}
}
catch (IOException e) {
//Oh well
}
catch(IndexOutOfBoundsException e){
//Oh well #2
}
return bytes;
}
This isn’t just my issue. I suspect Discord made a breaking change.
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Fix sound or audio problems in Windows - Microsoft Support
Check to make sure your audio devices aren't muted and haven't been disabled. Select and hold (or right-click) the Speakers icon on the...
Read more >Troubleshoot audio and video issues on your computer or ...
Android: To ensure that audio isn't being sent to the headphone jack, plug headphones in, and then unplug them. If the problem persists, ......
Read more >How to Fix Android Messages Having No Notification Sound
Tap the Sound option and select one of your ringtones / notification ; this will be the sound that plays when you get...
Read more >Audio Not Working in Windows 10? 9 Ways to Fix Sound ...
Head to Settings > Update & Security > Troubleshoot > Additional troubleshooters and select Playing Audio. Follow the instructions, and ...
Read more >Why Is My Sound Not Working? 5 Troubleshooting Tips for PCs
2. Restart or change your audio device · Try restarting your PC · If this doesn't solve the problem, you may need to...
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
I was informed by @amishshah (hydrabolt, aka the discord.js maintainer) about similar issues related to audio receive functionality. We now both agree that this has to be discord’s fault. I will keep this issue open in order to track further development.
@MinnDevelopment looks like that fixed it. Thanks!