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 MPRIS seeking and SetPosition #1783

Merged
merged 2 commits into from
Apr 8, 2024
Merged

Conversation

ferdnyc
Copy link
Member

@ferdnyc ferdnyc commented Apr 6, 2024

Correct the math we use to perform seek operations via MPRIS, since KDEConnect uses microseconds for seek offsets even though they use milliseconds for position values. (MPRIS uses microseconds everywhere.)

Also, implement SetPosition() directly instead of computing the offset from the current position and calling Seek(), because some players don't respect arbitrary Seek() lengths.

Picking up the currently-playing trackid at the time the SetPosition() call is handled and assuming it's the same track it was intended for is somewhat risky, but picking up the current Position and making the same assumption (which is what the previous code did) carried the exact same amount of risk.

Fixes: #1779

Copy link
Collaborator

@andyholmes andyholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice investigation on Chrome weirdness and bonus points for the comment.

@ferdnyc
Copy link
Member Author

ferdnyc commented Apr 8, 2024

Might as well get this one in too, before we start making release noises.

@ferdnyc ferdnyc merged commit 7ba0830 into GSConnect:main Apr 8, 2024
3 checks passed
@ferdnyc ferdnyc deleted the mpris-offsets3 branch April 8, 2024 19:35
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.

Rewind/forward buttons on mobile cause the file playing to restart/finish
2 participants