sedmelluq / lavaplayer

Audio player library for Discord
Apache License 2.0
958 stars 248 forks source link

Player joins/leaves channel in loop #658

Open dylan-park opened 3 years ago

dylan-park commented 3 years ago

I am having issues implementing lavaplayer server side using Maven. I am trying to play local files one at a time, no queue or playlist functionality used aside from the single track that has to be queued up. This works as a basic soundboard, effectively. The expected behavior is for a command to be called, the bot joins the channel where the caller is, it plays the sound called, then leaves the channel.

In my dev environment (Windows, jre1.8.0, Eclipse) the library works as expected in my bot. This holds true when I package the bot into a jar, and run it on windows (jre1.8.0 and se11.0.10) as well, with no unexpected behavior.

When I move the jar to my ubuntu server (openJDK1.8.0) every other part of my bot functions as normal, but lavaplayer has unexpected behavior. My bot will join the correct channel, but will not play any audio. It will stay in the channel for the correct length of the audio file, then it will leave and instantly rejoin. This will repeat for as long as I leave the bot on.

I have logging on and nothing is ever thrown, no load fails, a matching file is found, a track is loaded, there are no onTrackExceptions thrown, and AudioPlayer#getPlayingTrack even returns an InternalAudioTrack object. I observe these facts on both my dev environment as well as the server. I am lead to believe at the very least the track is loaded as the bot seems to know the right amount of time to stay in the channel. Am I missing a dependency server side that I just happened to have on my windows environment?

MCOfficer commented 3 years ago

Worth noting that the joining of discord channels is not handled by LP at all, rather by your discord API wrapper. If your bot for some reason fails to join the VC, it's probably an issue related to that library, not LP.

Edit: check if you see any errors in the debug log on your server.

dylan-park commented 3 years ago

Ugh, I've been looking at this so long today I completely forgot AudioManagers were a function of JDA and not LP. I wrote the code a while back specifically for windows, it is only recently I am trying to move it to this environment, and it seems I have forgotten things along the way. I appreciate the sanity check, I'll probably have to take this there if I want help, as I am not seeing any errors on the server unless I configured l4j2 wrong. Otherwise no obvious stacktraces to follow.

proohit commented 1 year ago

Can confirm it's coming from JDA. Had the same issue, updated to the latest JDA version (5.0.0-beta.8 in my case), updated all imports and worked again