GithubHelp home page GithubHelp logo

lavalink-devs / lavalink Goto Github PK

View Code? Open in Web Editor NEW
1.5K 33.0 655.0 2.29 MB

Standalone audio sending node based on Lavaplayer.

Home Page: https://lavalink.dev/

License: MIT License

Java 3.10% Dockerfile 0.34% Kotlin 96.57%
lavalink lavaplayer audio discord docker spring-boot hacktoberfest

lavalink's People

Contributors

1lucas1apk avatar angelobreuer avatar anothergenz avatar bytealex avatar cloudwithax avatar deivu avatar devoxin avatar devyukine avatar drschlaubi avatar duncte123 avatar evieepy avatar fabricio20 avatar freyacodes avatar lulalaby avatar minndevelopment avatar muh9049 avatar ooliver1 avatar repulser avatar samophis avatar schnapster avatar sebm253 avatar shredder121 avatar theessem avatar thepedroo avatar thewsomeguy avatar topi314 avatar toxicmushroom avatar vicky5124 avatar viztea avatar walkyst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lavalink's Issues

Region Designation?

I see in the Eris client example they designated regions. Is it possible to 'assign' a lavalink node to a region? If so what is the config style like for that?

Thanks!

Lavalink v2 roadmap

Lavalink v2 will be addressing issues about the robustness of Lavalink. By moving several actions to REST we can more easily assure that actions have occurred successfully, like playing a track or joining a voice channel.

Server/protocol changes

  • Make the REST server mandatory
  • Create a "hello" OP which indicates the REST server base URL, as well as an authorization header
  • Redo the docs
  • Destroy method

Replace these WS OPs with REST

  • connect
  • disconnect
  • play
  • stop
  • pause
  • seek
  • volume

JDA client changes

  • Action queue similar to JDA's RestAction system
  • Documentation changes where needed
  • Remove deprecated methods

These changes aren't final and discussion is encouraged.

REST API: Extremely slow response time on Youtube MIX playlists.

Youtube can make temporary playlists called mixes for the user. The difference between these and normal playlists is that the video's aren't numbered and once all 50 are watched another 50 get added (plus they exist temporary). For the Youtube API these should behave just like a normal playlist. But for some reason I had Lavalinks REST API take 20 seconds to perform a request to a Youtube mix.

These are response times I collected with Postman:
https://sharex.reinfernhout.xyz/i/20ufF.png

When testing with the Youtube API I found no longer response times for Youtube mixes myself.

[BUG] NPE crash

during development of our new lib / bot we have been having issues with lava player NPE causing a stack and for LavaLink to exit which causes all connections to the player to close etc

the issue seams to be when a shard restarts and reconnects to discord (and to lava) which will eventually timeout lavalink's connection to discord due to no resume support which is fine.

the expected behaviour would be on a socket close to have the error be handled so other connections dont also get destroyed (i dont think a lavalink instance per shard is desired), im most likely hitting this issue more than anyone else due to the rate we are restarting shards and bots.

NPE below:

java.lang.NullPointerException: null
    at lavalink.server.io.SocketServer.close(SocketServer.java:130)
    at lavalink.server.io.SocketServer.onClose(SocketServer.java:122)
    at org.java_websocket.server.WebSocketServer.onWebsocketClose(WebSocketServer.java:595)
    at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:504)
    at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:515)
    at org.java_websocket.WebSocketImpl.eot(WebSocketImpl.java:563)
    at org.java_websocket.SocketChannelIOHelper.read(SocketChannelIOHelper.java:42)
    at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:406)
    at java.lang.Thread.run(Thread.java:834)

if there is anything else i can provide please let me know

Send the Lavalink-Major-Version header in REST responses

As per docs:

  • Lavalink v3.0 now reports its version as a handshake response header. Lavalink-Major-Version has a value of 3 for v3.0 only. It's missing for any older version.

This would be a very useful feature, if not for the fact that most WS libraries do not expose the handshake, and thus provide no ability to recover that header. While at present it's possible to distinguish Lavalink 3.x and 2.x by checking REST response type (array vs object), this is a fragile approach that might not work in the future.

TeamCity - Never Logs In

Hi, tried it from two computers and two different networks but Team City never logs in. I was able to get into it fine last time I used it.

No error code, just spins on the login button for eternity.

Issue with updating volume on any stream/track with latest Lavalink Dev build

When loading an OPUS stream in this case, http://janus.cdnstream.com:5397/autodj - with the new Lavalink Dev branch update (with the new Lavaplayer version 1.2.63 that gets Ogg/Opus metadata as well as icy*- metadata from streams such as this one), the following error occurs using FredBoat (so the Java LavalinkClient):

https://hastebin.com/wiqapotogi.log https://sentry.io/share/issue/6be7059e02494827b2c05f243a288bb7/

[2018-04-14 00:44:16,129] [ INFO ] [WebSocketWorker-18] lavalink.server.io.SocketServer: {"volume":100,"op":"play","startTime":0,"track":"QAAAhQIAA0VDRAAQRUMgRGlzY29yZCBSYWRpb3//////////ACZodHRwOi8vamFudXMuY2Ruc3RyZWFtLmNvbTo1Mzk3L2F1dG9kagEBACZodHRwOi8vamFudXMuY2Ruc3RyZWFtLmNvbTo1Mzk3L2F1dG9kagAEaHR0cAADb2dnAAAAAAAAAAA=","guildId":"249664293656592384","pause":false}


Now using Lavaplayer 1.2.63 directly doesn't have any issues on another implementation -- and using a different (here just JS) Lavalink client implementation it works fine except/until sending a volume update (for this client implementation) that is not unity/100 causes the stream to end with the same decoding error:

[01:12:56] [ INFO ] [SocketServer] {"op":"play","guildId":"249664293656592384","track":"QAAAhQIAA0VDRAAQRUMgRGlzY29yZCBSYWRpb3//////////ACZodHRwOi8vamFudXMuY2Ruc3RyZWFtLmNvbTo1Mzk3L2F1dG9kagEBACZodHRwOi8vamFudXMuY2Ruc3RyZWFtLmNvbTo1Mzk3L2F1dG9kagAEaHR0cAADb2dnAAAAAAAAAAA="}
[01:14:01] [ INFO ] [SocketServer] {"op":"volume","guildId":"249664293656592384","volume":1}
[01:14:02] [ ERROR] [LocalAudioTrackExecutor] Error in playback of http://janus.cdnstream.com:5397/autodj
com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something went wrong when decoding the track.
	at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:40)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:260)
	at com.sedmelluq.discord.lavaplayer.container.ogg.OggAudioTrack.process(OggAudioTrack.java:40)
	at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:27)
	at com.sedmelluq.discord.lavaplayer.source.http.HttpAudioTrack.process(HttpAudioTrack.java:51)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:90)
	at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:357)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.IllegalStateException: Encoding failed with error -1
	at com.sedmelluq.discord.lavaplayer.natives.opus.OpusEncoder.encode(OpusEncoder.java:47)
	at com.sedmelluq.discord.lavaplayer.format.transcoder.OpusChunkEncoder.encode(OpusChunkEncoder.java:30)
	at com.sedmelluq.discord.lavaplayer.filter.volume.AudioFrameVolumeChanger.rebuild(AudioFrameVolumeChanger.java:61)
	at com.sedmelluq.discord.lavaplayer.track.playback.AudioFrameBuffer.rebuild(AudioFrameBuffer.java:215)
	at com.sedmelluq.discord.lavaplayer.filter.volume.AudioFrameVolumeChanger.apply(AudioFrameVolumeChanger.java:105)
	at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.checkDecoderNecessity(OpusPacketRouter.java:170)
	at com.sedmelluq.discord.lavaplayer.container.common.OpusPacketRouter.process(OpusPacketRouter.java:85)
	at com.sedmelluq.discord.lavaplayer.container.ogg.OggOpusTrackProvider.provideFrames(OggOpusTrackProvider.java:90)
	at com.sedmelluq.discord.lavaplayer.container.ogg.OggAudioTrack.processTrackLoop(OggAudioTrack.java:59)
	at com.sedmelluq.discord.lavaplayer.container.ogg.OggAudioTrack.lambda$process$0(OggAudioTrack.java:42)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:248)
	... 8 common frames omitted

The stream here does work fine, except the volume update breaks it with the same encoding error.

The reasons I can see this happening are:

  1. Something with startTime and volume with Lavalink/client
  2. Passing the play op without a startTime or volume by default (as seen above) works fine; so it must be something to do with one of those (volume/startTime)
  3. There aren't issues directly with Lavaplayer: using 1.2.63 with Lavaplayer directly works fine, including volume changes.

Weird application.yaml causes stupid problems

While I admit I'm an idiot for not realizing the issue sooner, I spent the better part of 12 hours figuring out why lavalink would silently exit with NO logs at all.

Turns out my application.yaml was causing the problem. After deleting it, lavalink worked fine. Would be super nice for future people if some error was thrown for them to see.

Current functionality: https://i.imgur.com/mbtPrYT.png

Failing to connect to voice channels

Sometimes lavalink will fail to connect to voice channels. Not sure if it's an issue with the lavalink server or with eris-lavalink. Sometimes it will also fail to disconnect from the voice channel, and it won't be able to connect again unless the connected client is restarted or the bot is "voice kicked" from the channel.

Link to related issue: briantanner/eris-lavalink#4

Debug endpoint disable feature

I personally find the debug endpoint really useful, so I would happily use it for some stuff that the stats endpoint won't send to me (like the lavalink server version), however it's not really a wise idea to have this endpoint open for "public" lavalink instances, where not just one, but many owners share the same server. I don't want them to break any internal or execute remote code on the server. So a config boolean definition would be awesome to have.

PS: are there any plans on multiple passwords?

https://github.com/Frederikam/Lavalink/blob/a6f5631b0ddd4b25a7e6720ae3f08c3a0a9729b5/LavalinkServer/src/main/java/lavalink/server/util/DebugRestHandler.java#L58-L83

NullPointerException in websocket when playing track

I'm getting this error on the LavaLink log when adding a track trought IPlayer#playTrack

[13:17:00] [ INFO ] [SocketServer] {"op":"play","startTime":0,"track":"QAAAlQIAHlZhdGUgTWMgLSBSdW1vIChwcm9kLiBUw7N4aWNvKQANTWFsQW1hZG9zUHJvZAAAAAAAA7U4AAtmUnJWYm5ZblIyZwABACtodHRwczovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PWZSclZiblluUjJnABdzcG90aWZ5X3BsYXlsaXN0X2ltcG9ydAAAAAAAAAAA","guildId":"219254781384851467","pause":false}
[13:17:00] [ ERROR] [SocketServer] Caught exception in websocket
java.lang.NullPointerException: null
        at lavalink.server.io.SocketServer.onMessage(SocketServer.java:158)
        at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:524)
        at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:417)
        at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:170)
        at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:781)

Exception while sending stats

Running default config.

2018-11-01 14:38:06.741 ERROR 16780 --- [pool-2-thread-1] lavalink.server.io.StatsTask             : Exception while sending stats

org.json.JSONException: JSON does not allow non-finite numbers.
        at org.json.JSONObject.testValidity(JSONObject.java:2214) ~[json-20180813.jar!/:na]
        at org.json.JSONObject.put(JSONObject.java:1813) ~[json-20180813.jar!/:na]
        at org.json.JSONObject.put(JSONObject.java:1720) ~[json-20180813.jar!/:na]
        at lavalink.server.io.StatsTask.sendStats(StatsTask.java:93) ~[classes!/:na]
        at lavalink.server.io.StatsTask.run(StatsTask.java:56) ~[classes!/:na]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:na]
        at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:na]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:na]
        at java.base/java.lang.Thread.run(Unknown Source) [na:na]

oshi.util.ParseUtil : Number is too big for a long parsing string to long array

Default config ~ discord.js-lavalink

2018-11-09 13:58:57.036 ERROR 18038 --- [pool-2-thread-1] oshi.util.ParseUtil : Number is too big for a long parsing string '18038 (java) S 1012 18038 1012 34817 18038 4202496 105074 996 4 1 1804 66 0 0 20 0 36 0 652454 5971169280 92864 18446744073709551615 4194304 4197664 140727357843456 140727357826128 140379713085335 0 0 0 16800975 18446744073709551615 0 0 17 3 0 0 0 0 0 0 0 0 0 0 18038 7164 7164 7164' to long array

Identifier for REST /loadtracks

When using a SoundCloud track ID as the identifier, the REST API returns nothing. Is this normal? Am I missing the proper identifier? (I checked by /decodetrack as well which returned the identifier - is that the only way to get SoundCloud info?) - I apologize if I'm missing something obvious! YouTube works fine.

Generify Lavalink-Client

This issue is only relevant to people using the JDA client.

Here at FredBoat we are working on separating most of our business logic (mostly commands) from JDA into two different services. The problem with this is that Lavalink-Client is tightly coupled to JDA. I see two solutions to this problem:

  1. Write a generic Lavalink client for the JVM
  2. Heavily modify the existing Lavalink-Client to be generic, with an implementation for JDA

Solution 2 is clearly the easiest solution. The way I see myself doing it would be to make the Lavalink and maybe Link abstract. This would cause breaking changes, but hopefully rather few.

By making Lavalink generic, users will likely also be able to use discord4j and javacord. Feedback is welcome.

REST API: /loadtracks return friendlyexception

When using the REST API endpoint /loadtracks and it fails due to copyright block, the response given back is the following

{
   "playlistInfo": {},
   "loadType": "LOAD_FAILED",
   "tracks": []
}

is it possible to also have the reason why the track failed to load? For example "This video contains content from whomever, who has blocked it in your country on copyright grounds."

Java 8 compatibility issues

It appears that the jars compiled by Javac 9 on TeamCity have faulty compatibility with Java 8. A solution could be to use a different version of the JDK on TC.

java.lang.ClassNotFoundException: com.sedmelluq.discord.lavaplayer.jdaudp.NativeAudioSendFactory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Temporary workarounds:

  • Upgrading to at least Java 9
  • Compiling from source with ./gradlew build

Dispatch events/updates in response to successful requests

this is the biggest thing lavalink misses imo so far, and has already inspired the creation of 2 different audio node servers that do notify clients of successful updates.

what i mean by this is, let's say you set the volume to 200. how do you know it worked? what if you got an error? you can't (easily) and there's no (good) workaround to knowing something succeeded or errorred. i hope lavalink will get this functionality one day as it's pretty annoying having to just rely and hope that everything went right. what if i want to know that i updated the volume? what if i want to know what bands changed and to what values? what if i want to see if lavalink errored? all of this information can be pretty helpful to bot developers and i think it's worth adding.

so far, there's no way to be certain of volume updates, pausing/resuming or tracks starting, and while the reason given for that is that they're all client side, the point i'm trying to make is that the clients depend on the server for all their functionality and can't be sure of the vast majority of that, and in the rare-ish chance that an error does happen, clients don't know of that.

Not emitting TrackEndEvent for a YouTube Livestream

A server I'm in (that serves as a radio server) has 9 bots; all playing different streams, all playing from the same Lavalink server. There's one bot in particular though that drops its stream entirely usually immediately or after a while, but doesn't seem to be receiving any events or emitting any events (log level is set to debug and the client's websocket isn't logging any Received Event messages). The link to the stream that's causing issues: https://www.youtube.com/watch?v=ueupsBPNkSc

Missing option to disable native audio

When testing LavaLink on new systems it would be nice to have a config option to disable native audio sending, since the internal checks do not account for new kernels/systems.

LavaLink seems to default NAS to enabled, making it impossible to test the resources on (currently) unsupported systems like linux-aarch64.

[Suggestion] [REST] Way to change YouTube Playlist size limit

So it would appear that the current limit is lavaplayer's default (600) tracks. From what I've seen, there's no property to change this.

Perhaps a property that can be changed in application.yml to set the maximum amount of tracks loaded from a playlist?

Lavalink 3 is incompatbile with Java version <10

When I attempt to run Lavalink using Java 9, I get the following:

P:\Mateusz\Developer\Discord\Lavalink>java -jar Lavalink.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: lavalink/server/Launcher has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 53.0
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
        at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
        at java.base/java.net.URLClassLoader.access$100(Unknown Source)
        at java.base/java.net.URLClassLoader$1.run(Unknown Source)
        at java.base/java.net.URLClassLoader$1.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.net.URLClassLoader.findClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

Here's my Java version:

P:\Mateusz\Developer\Discord\Lavalink>java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

Presumably this means that my Java version (9) is older than required (presumably 10).

Considering that large number of servers running Lavalink will not have anything above Java 8 (since a lot of stuff is based on Debian stable or oldstable, and these go up to Java 8, maybe 9 only), this effectively renders Lavalink 3 useless on most server machines.

SocketTimeoutException: Read timed out

Hello,

I've been experiencing SocketTimeouts when playing the Monster cat 24/7 stream. When I first issue the play command, the bot will play the stream normally, but anywhere from 15mins to 1hour, Lavalink will stop playing out of nowhere and the following exception will be raised: https://sentry.io/share/issue/3232313230322e333536343935383737/

This doesn't happen when playing long videos from youtube, so it seems to be an issue related to twitch.tv.

I'm running lavalink as a systemd unit service, on an ubuntu 16.04 box. Neither my machine or network are being rammed, for now this machine is only playing one song at a time.

Java information (default-jre):

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

If it matters, lavalink is running with root privileges. I am using eris-lavalink as a client.

Is this normal behavior? Am I supposed to handle this somehow?

erros.log:
[11:27:36] [lava-daemon-pool-info-loader-2-thread-1] [AudioLoader] Load failed com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Loading Twitch channel information failed. at com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager.fetchStreamChannelInfo(TwitchStreamAudioSourceManager.java:146) at com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager.loadItem(TwitchStreamAudioSourceManager.java:59) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.checkSourcesForItemOnce(DefaultAudioPlayerManager.java:429) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.checkSourcesForItem(DefaultAudioPlayerManager.java:415) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$createItemLoader$0(DefaultAudioPlayerManager.java:219) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at sun.security.ssl.InputRecord.read(InputRecord.java:503) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139) at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155) at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface.execute(HttpInterface.java:60) at com.sedmelluq.discord.lavaplayer.tools.io.HttpClientTools.fetchResponseAsJson(HttpClientTools.java:286) at com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager.fetchStreamChannelInfo(TwitchStreamAudioSourceManager.java:144) ... 8 common frames omitted [17:46:06] [lava-daemon-pool-info-loader-2-thread-1] [AudioLoader] Load failed com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Loading Twitch channel information failed. at com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager.fetchStreamChannelInfo(TwitchStreamAudioSourceManager.java:146) at com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager.loadItem(TwitchStreamAudioSourceManager.java:59) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.checkSourcesForItemOnce(DefaultAudioPlayerManager.java:429) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.checkSourcesForItem(DefaultAudioPlayerManager.java:415) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$createItemLoader$0(DefaultAudioPlayerManager.java:219) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at sun.security.ssl.InputRecord.read(InputRecord.java:503) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139) at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155) at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface.execute(HttpInterface.java:60) at com.sedmelluq.discord.lavaplayer.tools.io.HttpClientTools.fetchResponseAsJson(HttpClientTools.java:286) at com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager.fetchStreamChannelInfo(TwitchStreamAudioSourceManager.java:144) ... 8 common frames omitted

I can run tests and provide more information if needed.

Handle resumes and reconnects correctly

Original issue: https://github.com/Frederikam/FredBoat/issues/403

Tested this with latest LL and FB code, resumes are not handled optimally.
The bot always leaves the voicechat, music is paused, unpaused on rejoin.
Sometimes it does not rejoin, and therefore does not continue the playback.

Reconnects break it worse: Never rejoins the voicechat, but always keeps playing.

Instead, these events should be handled the same way they are handled when running without LL:
Resumes are, if at all, noticed by a short audio cut out.
On Reconnects the VoiceChannel is left, and upon restoration of the connection, rejoined and the playback continued.

Versioning

The continued split between v2 and v3 branches keeps causing unnecessary work (see merging of #125), as well as confusion in the chat when talking about where an issue is happening.

I propose a faster moving versioning on the main branch. There is no good reason except vanity (imho) to keep holding off the merge of v3 into the main development branch. We have already discussed how the breaking change prompting the v3 bump could have been avoided (instead of changing the endpoint, adding a new one would have been a backwards compatible possibility), so we can all agree that a major version bump should not be happening in the reasonably forseeable future.

There are two more annoyances related to versioning:
Github tags would be super helpful. Many times ppl get confused by the CI server and use builds from outdated, or non-supported branches. However, due to the LavalinkClient residing in the same repo as the LavalinkServer, we can't version them individually by tags. They don't even use any shared code, so moving the client into it's own repo would be the sane decision.

Here are the proposed milestones for the current features in development / things required to make it work:

2.2:

  • Release the outstanding changes on the dev branch #132

3.0:

  • Move client to its own repo (I would ask @Frederikam to consider doing this, but I can also offer setting it up under the FredBoat org) #128
  • Generate version from git tag (I would PR this) #129
  • Release all the current changes that reside on the v3 branch.

Rough roadmap for post 3.0:

3.1, or general 3.x minors, depending on how development goes:

  • Replace JDAA with Magma

Majors:

  • Java 11
  • #119 Plugin system

[Bug] YouTube Mix playlists only return a single track

Links to YouTube Mix playlists only appear to return the video linked to the watch?v= parameter rather than the videos from the list parameter

Example URL: https://www.youtube.com/watch?v=v7Srbp8WPMY&list=RDv7Srbp8WPMY

Timeout on /loadtracks when trying to load localfile for a second time

When I try to /loadtracks or just find tracks with lavalink.py for the first time it loads just fine:

img1

Log of the first request:

[2018-03-03 16:35:01,783] [ INFO ] [http-nio-0.0.0.0-8822-exec-4] l.s.player.AudioLoaderRestHandler: GET /loadtracks
[2018-03-03 16:35:01,786] [ INFO ] [lava-daemon-pool-info-loader-2-thread-1] lavalink.server.player.AudioLoader: Loaded track ILLUMINATI CONFIRMED - MLG Sound Effects

But for the second time I just get a timeout in lavalink.py and in postman just says Loading... forever.

img2

Log of the second request (it's the same as the first):

[2018-03-03 16:36:14,148] [ INFO ] [http-nio-0.0.0.0-8822-exec-6] l.s.player.AudioLoaderRestHandler: GET /loadtracks
[2018-03-03 16:36:14,150] [ INFO ] [lava-daemon-pool-info-loader-2-thread-1] lavalink.server.player.AudioLoader: Loaded track ILLUMINATI CONFIRMED - MLG Sound Effects

Exception while sending stats

Default config*

2018-11-09 12:12:34.259 ERROR 1061 --- [ool-13-thread-1] oshi.util.ParseUtil                      : Number is too big for a long parsing string '1061 (java) S 1012 1061 1012 34817 1061 4202496 150030 10684 105 2 5748 295 2 6 20 0 195 0 1275 6169038848 132393 18446744073709551615 4194304 4197664 140720428812160 140720428794832 139998015491991 0 0 0 16800975 18446744073709551615 0 0 17 1 0 0 0 0 0 0 0 0 0 0 1061 7164 7164 7164' to long array
2018-11-09 12:12:34.267 ERROR 1061 --- [ool-13-thread-1] lavalink.server.io.StatsTask             : Exception while sending stats

org.json.JSONException: JSON does not allow non-finite numbers.
        at org.json.JSONObject.testValidity(JSONObject.java:2214) ~[json-20180813.jar!/:na]
        at org.json.JSONObject.put(JSONObject.java:1813) ~[json-20180813.jar!/:na]
        at org.json.JSONObject.put(JSONObject.java:1720) ~[json-20180813.jar!/:na]
        at lavalink.server.io.StatsTask.sendStats(StatsTask.java:93) ~[classes!/:na]
        at lavalink.server.io.StatsTask.run(StatsTask.java:56) ~[classes!/:na]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
        at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

Exception while handling websocket message

here is the full error

2019-01-17 01:43:02.705 ERROR 19316 --- [   XNIO-2 I/O-1] lavalink.server.io.SocketServer          : Exception while handling websocket message

java.io.EOFException: null
        at java.base/java.io.DataInputStream.readFully(DataInputStream.java:202) ~[na:na]
        at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:614) ~[na:na]
        at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:569) ~[na:na]
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.decodeTrack(DefaultAudioPlayerManager.java:271) ~[lavaplayer-1.3.10.jar!/:na]
        at lavalink.server.util.Util.toAudioTrack(Util.java:44) ~[classes!/:na]
        at lavalink.server.io.WebSocketHandlers.play(WebSocketHandlers.kt:53) ~[classes!/:na]
        at lavalink.server.io.SocketServer.handleTextMessageSafe(SocketServer.kt:149) ~[classes!/:na]
        at lavalink.server.io.SocketServer.handleTextMessage(SocketServer.kt:129) ~[classes!/:na]
        at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:56) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:58) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:113) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:84) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81) ~[spring-websocket-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:286) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.jsr.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:168) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.jsr.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:165) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:602) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:592) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.jsr.FrameHandler.invokeTextHandler(FrameHandler.java:266) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.jsr.FrameHandler.onFullTextMessage(FrameHandler.java:317) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:156) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:152) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.websockets.core.BufferedTextMessage.read(BufferedTextMessage.java:105) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.websockets.core.AbstractReceiveListener.readBufferedText(AbstractReceiveListener.java:152) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.websockets.core.AbstractReceiveListener.bufferFullMessage(AbstractReceiveListener.java:90) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.websockets.jsr.FrameHandler.onText(FrameHandler.java:182) ~[undertow-websockets-jsr-1.4.25.Final.jar!/:1.4.25.Final]
        at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:44) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
        at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:948) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:929) ~[undertow-core-2.0.14.Final.jar!/:2.0.14.Final]
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
        at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
        at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:561) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]

Decoding multiple tracks

Using the /loadtracks endpoint returns lavaplayer encoded tracks that are almost always decoded immedietly after using the /decodetrack endpoint to get track info. When used with a playlist of hundreds of songs or a search result this can lead to hundreds of calls to the decode endpoint.

Proposed solutions:

Solution 1: Providing track info with each track in the /loadtracks endpoint.

GET /loadtracks?identifier=dQw4w9WgXcQ&info=true
{
  "tracks": [
    {
      "track": "AAAA==",
      "info": {
        "title": "48 hours of screaming",
        ...
      }
    }
  ]
}

Advantage: No additional requests have to be made to load tracks and view track info.

Disadvantage: Modifies the existing response format which could make existing clients incompatible with the endpoint.

Solution 2: Decoding multiple tracks in the /decodetrack endpoint.

GET /decodetrack?tracks=AAAA==,BBBB==,CCCC==,...
[
  {
    "track": "AAAA==",
    "info": {
      "title": "48 hours of screaming",
      ...
    }
  },
  ...
]

Advantage: The endpoint was added yesterday so it is unlikely that changing the response format would lead to incompatible clients.

Disadvantages:

  • One additional request has to be made to decode tracks whereas with solution 1 it is not required.
  • URLs have a length limit (iirc) so decoding hundreds of tracks will not be possible.

Misleading documentation

startTime and endTime are longs, not strings. this leads to a small issue if you implement it the exact way the IMPLEMENTATION.md file describes.

relevant source code line here.
relevant documentation line here.

[Suggestion] [REST] Search types in loadtracks

Perhaps a few fields (such as the ones below) could be included in the response?

Field Type Description
isSearchResult boolean Whether or not the results are from a search
provider string Which provider returned the tracks (e.g. YouTube, Vimeo etc)
isPlaylist boolean Whether or not the results are from a playlist

VoiceServerUpdateInterceptor throws NPE

Link#getCurrentSocket() may return null resulting in this NPE in the VoiceServerUpdateInterceptor:

java.lang.NullPointerException: null
    at lavalink.client.io.VoiceServerUpdateInterceptor.handleInternally(VoiceServerUpdateInterceptor.java:63)
    at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
    at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:1001)
    at net.dv8tion.jda.core.requests.WebSocketClient.onTextMessage(WebSocketClient.java:684)
    at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1052)
    at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
    at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
    at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
    at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
    at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.