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

Seeking 'Player' does not update player.time() instantly, and there is no way to wait for update #448

Open
vhaudiquet opened this issue Jan 8, 2022 · 0 comments · May be fixed by #465
Open
Labels
bug Something isn't working

Comments

@vhaudiquet
Copy link

vhaudiquet commented Jan 8, 2022

Describe the bug
Consider the following code :

private xyz.gianlu.librespot.player.Player spotifyPlayer;

void seek(int t)
{
    spotifyPlayer.seek(t);
    System.out.println("Seek to " + t + ", but player reports " + spotifyPlayer.time());
}

You would expect reported time to be t, but it is not, because there seems to be a delay necessary to seek :

2022-01-08 14:52:57.832 24582-24582/v.blade I/System.out: Seek to 119860, but player reports 5887

This is (to me) a bug ; i suggest the following fixes :

  • Either use an internal variable position that can be updated instantly and report the value of that variable, even if the player has not already done seek to the position (as it requires network time, i understand)
  • Or provide a function like waitReady() to wait for player actualization ; i tried with waitReady() but the player is already in a ready state as it is already playing i think
  • Or provide a way to give a callback to the seek function, for when seek is done

EDIT: I found the event 'onTrackSeeked', which i guess i can work with.
I think that "seeked" does not exist in english, the verb is "sought" ?
Anyway i still think that the first fix is the best way to go because using the API is really weird without that.

To Reproduce
Just use previous code.

Version/Commit
librespot-player:1.6.2

@vhaudiquet vhaudiquet added the bug Something isn't working label Jan 8, 2022
iscle added a commit to iscle/librespot-java that referenced this issue Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant