Lavalink JSON uses wrong name for atuo stopping songs.
Created by: Soyvolon
Summary
The LavalinkGuildConnection.PlayPartialAsync(track, start, end);
sends a JSON to Lavalink with the end variable labeled as stopTime
. As per Lavalink code, this is wrong as Lavalink looks for endTime
, and therefore the songs will not stop automatically.
Details
DSharpPlus-Nightly-00760
The JSON that DSharpPlus.Lavalink dispatches:
{"track":"QAAAwAIAYERpYWxnYSdzIEZpZ2h0IHRvIHRoZSBGaW5pc2ghIChSZW1peCkgLSBQb2vDqW1vbiBNeXN0ZXJ5IER1bmdlb246IEV4cGxvcmVycyBvZiBUaW1lL0RhcmtuZXNzL1NreQAGc2hlZGR5AAAAAAAEzngAC1Y1RlRPYmlIUHNBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9VjVGVE9iaUhQc0EAB3lvdXR1YmUAAAAAAAAAAA==","startTime":30000,"stopTime":35000,"op":"play","guildId":"431462786900688896"}
As you can see it contains stopTime
insted of endTime
, causing Lavalink to not read an end variable.
Code from Lavalink:
if (json.has("endTime")) {
val stopTime = json.getLong("endTime")
if (stopTime > 0) {
val handler = TrackEndMarkerHandler(player)
. . .
Code is from this update
Steps to reproduce
- Start the latest version of Lavalink and DSharpPlus with the Lavlink extensions
- Play a song with
LavalinkGuildConnection.PlayPartialAsync(track, start, end);
, specifying a start and end time. - Listen as the song plays for longer than it should.
Notes
This is my PR from the Lavalink repo where I was told this answer.