TrackEncoder.Encode broken
See original GitHub issueDescribe the bug When i try to encode track and pass it to lavalink, lavalink send exception trying to parse them.
To Reproduce Steps to reproduce the behavior:
- Create LavalinkTrackInfo with Source - url
- Create LavalinkTrack from it
- Try to play
Expected behavior Track should play in lavalink.
- Lavalink4NET Version 3.0.0-preview.6
Additional context Lavalink logs:
2022-07-08 02:27:38.846 ERROR 757 --- [ XNIO-1 I/O-1] lavalink.server.io.SocketServer : Exception while handling websocket message
java.io.EOFException: null
at java.base/java.io.DataInputStream.readUnsignedShort(DataInputStream.java:345) ~[na:na]
at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:594) ~[na:na]
at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:569) ~[na:na]
at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.decodeTrackDetails(DefaultAudioPlayerManager.java:324) ~[lavaplayer-fork-1.3.97.jar!/:na]
at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.decodeTrack(DefaultAudioPlayerManager.java:272) ~[lavaplayer-fork-1.3.97.jar!/:na]
at lavalink.server.util.Util.toAudioTrack(Util.java:44) ~[classes!/:na]
at lavalink.server.io.WebSocketHandler.play(WebSocketHandler.kt:82) ~[classes!/:na]
at lavalink.server.io.WebSocketHandler.access$play(WebSocketHandler.kt:16) ~[classes!/:na]
at lavalink.server.io.WebSocketHandler$handlers$2.invoke(WebSocketHandler.kt:31) ~[classes!/:na]
at lavalink.server.io.WebSocketHandler$handlers$2.invoke(WebSocketHandler.kt:16) ~[classes!/:na]
at lavalink.server.io.WebSocketHandler.handle(WebSocketHandler.kt:50) ~[classes!/:na]
at lavalink.server.io.SocketServer.handleTextMessageSafe(SocketServer.kt:169) ~[classes!/:na]
at lavalink.server.io.SocketServer.handleTextMessage(SocketServer.kt:149) ~[classes!/:na]
at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:56) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:58) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:113) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:84) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81) ~[spring-websocket-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
at io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:286) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:170) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:167) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:604) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:594) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.FrameHandler.invokeTextHandler(FrameHandler.java:266) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.FrameHandler.onFullTextMessage(FrameHandler.java:317) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:156) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:152) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.BufferedTextMessage.read(BufferedTextMessage.java:105) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.AbstractReceiveListener.readBufferedText(AbstractReceiveListener.java:152) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.AbstractReceiveListener.bufferFullMessage(AbstractReceiveListener.java:90) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.jsr.FrameHandler.onText(FrameHandler.java:182) ~[undertow-websockets-jsr-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:44) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.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:951) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.Final]
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:932) ~[undertow-core-2.0.26.Final.jar!/:2.0.26.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]
My track (handmade created from handmade LavalinkTrackInfo):
{
"Author": "INTERWORLD",
"Duration": "00:02:22.8300000",
"Identifier": "QAAAZwIADU1FVEFNT1JQSE9TSVMACklOVEVSV09STEQAAAAAAAIt7gAIOTU5OTA4ODcAAQA1aHR0cHM6Ly9tdXNpYy55YW5kZXgucnUvYWxidW0vMTk2MjI4MjYvdHJhY2svOTU5OTA4ODc=",
"IsLiveStream": false,
"IsSeekable": true,
"Position": "00:00:00",
"Provider": 0,
"Source": "https://music.yandex.ru/album/19622826/track/95990887",
"Title": "METAMORPHOSIS",
"TrackIdentifier": "95990887",
"TrackInformation": {
"Author": "INTERWORLD",
"Duration": "00:02:22.8300000",
"IsLiveStream": false,
"IsSeekable": true,
"Position": "00:00:00",
"Source": "https://music.yandex.ru/album/19622826/track/95990887",
"Title": "METAMORPHOSIS",
"TrackIdentifier": "95990887"
}
}
If i try to serialize this URL via lavalink i get this track info:
{
"Author": "Unknown artist",
"Duration": "00:02:22.8890000",
"Identifier": "QAACbQIADVVua25vd24gdGl0bGUADlVua25vd24gYXJ0aXN0AAAAAAACLikBFmh0dHBzOi8vczU4OXNhcy5zdG9yYWdlLnlhbmRleC5uZXQvZ2V0LW1wMy83NEMwNDYyNjVCNEFFNjFCQ0E1ODAxMUIxQzY3NjI4Qy8wMDA1ZTM0MDM0NDI1OTFiL3JtdXNpYy9VMkZzZEdWa1gxX1NDN0lrMk9HMEJOTnJ1aXpRZU91dXlvSlladnl2NTFpblZNenZfdFRtdEtVRFVfTDlNeklTQU0zQmVRMUhYT3FISzU1d3N4MmRoZmZfUUkwZWdsZ3dpZHdIRFRQTTJ3Yy9mNTZhNGJjNWYzNWVhNGI4YTRiOTg0ZjdkODA2MzliMjQ0MDQ2OGZjMjg1MjMzYzliMGE4YzhiYzVhMWYxNjY1LzIyNjU5AAEBFmh0dHBzOi8vczU4OXNhcy5zdG9yYWdlLnlhbmRleC5uZXQvZ2V0LW1wMy83NEMwNDYyNjVCNEFFNjFCQ0E1ODAxMUIxQzY3NjI4Qy8wMDA1ZTM0MDM0NDI1OTFiL3JtdXNpYy9VMkZzZEdWa1gxX1NDN0lrMk9HMEJOTnJ1aXpRZU91dXlvSlladnl2NTFpblZNenZfdFRtdEtVRFVfTDlNeklTQU0zQmVRMUhYT3FISzU1d3N4MmRoZmZfUUkwZWdsZ3dpZHdIRFRQTTJ3Yy9mNTZhNGJjNWYzNWVhNGI4YTRiOTg0ZjdkODA2MzliMjQ0MDQ2OGZjMjg1MjMzYzliMGE4YzhiYzVhMWYxNjY1LzIyNjU5AARodHRwAANtcDMAAAAAAAAAAA==",
"IsLiveStream": false,
"IsSeekable": true,
"Position": "00:00:00",
"Provider": 0,
"Source": "https://s589sas.storage.yandex.net/get-mp3/74C046265B4AE61BCA58011B1C67628C/0005e3403442591b/rmusic/U2FsdGVkX1_SC7Ik2OG0BNNruizQeOuuyoJYZvyv51inVMzv_tTmtKUDU_L9MzISAM3BeQ1HXOqHK55wsx2dhff_QI0eglgwidwHDTPM2wc/f56a4bc5f35ea4b8a4b984f7d80639b2440468fc285233c9b0a8c8bc5a1f1665/22659",
"Title": "Unknown title",
"TrackIdentifier": "https://s589sas.storage.yandex.net/get-mp3/74C046265B4AE61BCA58011B1C67628C/0005e3403442591b/rmusic/U2FsdGVkX1_SC7Ik2OG0BNNruizQeOuuyoJYZvyv51inVMzv_tTmtKUDU_L9MzISAM3BeQ1HXOqHK55wsx2dhff_QI0eglgwidwHDTPM2wc/f56a4bc5f35ea4b8a4b984f7d80639b2440468fc285233c9b0a8c8bc5a1f1665/22659",
"TrackInformation": {
"Author": "Unknown artist",
"Duration": "00:02:22.8890000",
"IsLiveStream": false,
"IsSeekable": true,
"Position": "00:00:00",
"Source": "https://s589sas.storage.yandex.net/get-mp3/74C046265B4AE61BCA58011B1C67628C/0005e3403442591b/rmusic/U2FsdGVkX1_SC7Ik2OG0BNNruizQeOuuyoJYZvyv51inVMzv_tTmtKUDU_L9MzISAM3BeQ1HXOqHK55wsx2dhff_QI0eglgwidwHDTPM2wc/f56a4bc5f35ea4b8a4b984f7d80639b2440468fc285233c9b0a8c8bc5a1f1665/22659",
"Title": "Unknown title",
"TrackIdentifier": "https://s589sas.storage.yandex.net/get-mp3/74C046265B4AE61BCA58011B1C67628C/0005e3403442591b/rmusic/U2FsdGVkX1_SC7Ik2OG0BNNruizQeOuuyoJYZvyv51inVMzv_tTmtKUDU_L9MzISAM3BeQ1HXOqHK55wsx2dhff_QI0eglgwidwHDTPM2wc/f56a4bc5f35ea4b8a4b984f7d80639b2440468fc285233c9b0a8c8bc5a1f1665/22659"
}
}
In my TrackEncoder implementation i add additional action while encoding. To be honest, I do not remember the specific reason why I did so, but apparently in order to avoid this lavalink exception. My old code to create LavalinkTrack from links like this:
var newTrackInfo = new LavalinkTrackInfo(Author, Duration, IsLiveStream, IsSeekable, Position, directUrl, Title, directUrl);
return new LavalinkTrack(TrackDecoder.EncodeTrack(newTrackInfo, StreamProvider.Http, writer => {
writer.WriteString("mp3");
}), newTrackInfo);
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Encoder Signal Overview & Troubleshooting Common Issues
Learn how to interpret and diagnose common encoder signal issues to uncover error sources. See quick tips and recommendations to troubleshoot and correct ......
Read more >Four Steps to End Encoder Problems - YouTube
Share your videos with friends, family, and the world.
Read more >Encoder still broken since v44 - Meta Community Forums
Encoder still broken since v44 · It happend in any apps, including dash. · Bitrate doesn't affect it, encoder resolution doesn't affect it....
Read more >Broken Encoder Wheel? Good news! - Mounts
I put the size, number of "teeth" or tracks (which in my wheel was 108). The program will automatically space them evenly and...
Read more >My encoding keeps stopping with errors : r/handbrake
Im trying to make an amv but I'm not sure whats wrong with the encoding. I looked at the activity logs, and below...
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
Yes, that works like a charm. Thank you so much!
So, back to the beginning. I think I confused the bump history of lavaplayer in Lavalink. Lavaplayer was not updated for a few years and the fork that is integrated into Lavalink has changed often. The current fork is the one from Walkyst. Which the Lavalink fork mentioned above uses a lavaplayer version which is based on the lavaplayer version from Walkyst. So, then I thought it used the custom version of lavaplayer, which indeed includes encoding the artwork URI into the track identifier, which lives on the
custom
branch of the lavaplayer fork. The actual version used from the fork is theoriginal
version, as you can see in your Lavalink version screen (1.3.98-original
). Theoriginal
seems to refer to the branch name, which is the version-compatible fork of lavaplayer, that is currently in use by the official Lavalink server.Now a minor difference between the audio source managers that load tracks provided by a file or URI, is that they perform a container probe (e.g., detecting the format of the audio track). This container probe result is encoded into the track identifier, which is your
mp3
string. The probe format belongs to additional track details that are passed by the audio source managers from lavaplayer. Specifically, all probing audio source managers, which are only thehttp
andlocal
audio source managers, encode this string (https://github.com/sedmelluq/lavaplayer/blob/master/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/ProbingAudioSourceManager.java#L47).The issue why the track probably did not play, using the fix method, was that there was an invalid probe specified which caused the track to reject from loading. On my setup it was working, because I did not know that you are using the Yandex API manually instead of using a natively integrated audio source manager.
So, the solution would be to store the container probe information in the LavalinkTrackInfo class, and encode or decode it for all probing audio sources.
I pushed a commit that addresses this issue and adds the container probe information and adds tests for it. I will push the package as 3.0.0-preview.10, please test if this version works for you.