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

getCurrentTime() fails as tracks are ending #3708

Open
Johnrobmiller opened this issue May 16, 2024 · 1 comment
Open

getCurrentTime() fails as tracks are ending #3708

Johnrobmiller opened this issue May 16, 2024 · 1 comment
Labels

Comments

@Johnrobmiller
Copy link
Contributor

Johnrobmiller commented May 16, 2024

I have a track whose duration is 6.81795, as logged using ws.getDuration(). I am also logging ws.getCurrentTime() on the timeupdate event.

The final log of ws.getCurrentTime() is 6.795971, which is incorrect. It ought to be 6.81795 because the track ended and this was the final time. When a track finishes, calls to getCurrentTime() should not be misleadingly reporting any time that is not the final time.

Note, although the call to getCurrentTime() is accurate in the finish event, the last call to getCurrentTime in the timeupdate event still ought to equal the song duration because, when a track finishes playing, that is a time update.

@katspaugh
Copy link
Owner

katspaugh commented May 17, 2024

I think this is something to blame the HTMLMediaElement for. We could add a workaround by artificially emitting a final event with the exact value of the total duration, though.

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

No branches or pull requests

2 participants