Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user only set user data independently in PlayerUpdateBuilder/Player #18

Closed
zvyap opened this issue Jan 19, 2024 · 6 comments
Closed

Comments

@zvyap
Copy link

zvyap commented Jan 19, 2024

In some cases, users may only want to set their user data instead of having to create the entire Track object. Lavalink only requires the user to provide an encodedTrack to be able to play music.

Creating the Track object is annoying because it requires dev.arbjerg.lavalink.protocol.v4.Track, which includes many Kotlin elements that are not user-friendly for Java developers.

Moreover, while the identifier can be modified independently, why there isn't a similar option for user data?

Edit:
What I mean for not user-friendly, my current solution
image

@duncte123
Copy link
Collaborator

As I replied in your other issue, I'll add a bulder for track updates.

@duncte123
Copy link
Collaborator

duncte123 commented Jan 20, 2024

Would you mind trying version e740a7293e99557ec81830e30d4f4538adf5efa5-SNAPSHOT with the new TrackUpdateBuilder class? It should do what you want.

You can get this version by adding the following repository

repositories {
    maven("https://maven.lavalink.dev/snapshots")
}

@zvyap
Copy link
Author

zvyap commented Jan 20, 2024

First, idk why it got such weird thing in Java (Decompiled source not accurate)
image

But updateTrack function looks good overall, receive user data from Lavalink server not tested
image

@duncte123
Copy link
Collaborator

Your first thing, that is exactly how I wrote it, the builder returns the PlayerUpdateTrack object.

Second, do not send both the encoded AND the identifier. Sending the identifier causes more latency because lavalink will have to look up the track again. The encoded object is the entire track including the identifier. Please have a look at the examples provided and the documentation on the builder.

Example: https://github.com/lavalink-devs/lavalink-client/blob/main/testbot/src/main/java/me/duncte123/testbot/AudioLoader.java#L22-L27
Documentation (also available if you press ctrl+q while with your mouse on a method): https://main.lavalink-client.pages.dev/lavalink-client/dev.arbjerg.lavalink.client.protocol/-track-update-builder/#-896813142%2FFunctions%2F769193423

@zvyap
Copy link
Author

zvyap commented Jan 22, 2024

Your first thing, that is exactly how I wrote it, the builder returns the PlayerUpdateTrack object.

Second, do not send both the encoded AND the identifier. Sending the identifier causes more latency because lavalink will have to look up the track again. The encoded object is the entire track including the identifier. Please have a look at the examples provided and the documentation on the builder.

Example: https://github.com/lavalink-devs/lavalink-client/blob/main/testbot/src/main/java/me/duncte123/testbot/AudioLoader.java#L22-L27 Documentation (also available if you press ctrl+q while with your mouse on a method): https://main.lavalink-client.pages.dev/lavalink-client/dev.arbjerg.lavalink.client.protocol/-track-update-builder/#-896813142%2FFunctions%2F769193423

First, okay. I just miss the 'interface' method in IUpdatablePlayer

Second, roger that.

@duncte123
Copy link
Collaborator

Resolved in version 2.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants