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

Fix load queue seeking #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mahmed2000
Copy link

@mahmed2000 mahmed2000 commented Dec 20, 2024

Mpv requires the file's sample table to be loaded before any seek commands are considered valid. IsSongLoaded was insufficient since mpv stops being idle before the file is ready, and before mpv allows seek commands to work. The original plan was to wait on the "file-loaded" event, but turns out mpv has the seekable property, which makes this trivial.

This checks if mpv has entered a seekable state every 100ms. The error still needs to be logged and handled since it can loop infinitely.

See #71 (comment) for context.

* Add method for mpvplayer to check if the player is allowed to seek

* Make the load queue functionality seek to the saved position when mpv is ready to seek
@xxxserxxx
Copy link
Collaborator

Reviewed and merged onto branch xxxserxxx

This should enable loading a saved queue and seeking to the last saved point, ĉu ne?

@mahmed2000
Copy link
Author

As far as I've tested, yes. The seeking for queue-loading on "l" works correctly with this change now.

To be clear, the existing implementation already had the seek call, all that was needed was to make it wait for the a-OK from mpv before trying.

What I haven't tested is if mpv gets a garbled link or anything else renders it in a state where it never enters a seekable state but keeps the file loaded. And if the user presses "l" multiple times in quick succession. Its all on a separate go-routine so it shouldn't matter too much, but still something to consider.

@xxxserxxx
Copy link
Collaborator

Hmm. I added the queue loading and saving, and I know I fussed a lot with the seeking before I gave up on it. I'm a little surprised that I left it in a state where it works properly, but I'm not going to look a gift horse in the mouth.

As I mentioned, your PR is merged into the xxxserxxx branch.

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

Successfully merging this pull request may close these issues.

2 participants