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

Media Element Binding for set currentTime is unreliable #3524

Closed
subz390 opened this issue Sep 7, 2019 · 7 comments · Fixed by #3530
Closed

Media Element Binding for set currentTime is unreliable #3524

subz390 opened this issue Sep 7, 2019 · 7 comments · Fixed by #3530
Labels

Comments

@subz390
Copy link

subz390 commented Sep 7, 2019

Describe the bug
The Media Element Binding for setting bind:currentTime={time} is unreliable when setting single times. For example a list of video position index markers. Clicking on an index, which sets the currentTime, doesn't always set the video position. Where as if I set currentTime via the DOM method then it does work every time.

To Reproduce
Here's a couple of examples the issue:
https://svelte.dev/repl/3470317362744bf296ae78b688445448?version=3.9.2
https://svelte.dev/repl/17fecf5e4b5449a79f7eda6abc480f19?version=3.9.2

@subz390
Copy link
Author

subz390 commented Sep 8, 2019

Awesome thanks @Rich-Harris - what is the release cycle for this as I'm "newish" to your PR -> master process. So I know when to upgrade my project and then I can feedback on the work am doing with this.

Rich-Harris added a commit that referenced this issue Sep 8, 2019
robustify bind:currentTime
@Rich-Harris
Copy link
Member

Released 3.10.1 with the fix — thanks!

@subz390
Copy link
Author

subz390 commented Sep 9, 2019

I've downloaded the above example app from the REPL and built it locally with Svelte v3.12.0 and the issue seems to be resolved on Firefox and Chrome (latest builds, Windows 10).
When it comes to other videos from my local server, Chrome is fine but Firefox is back to the same issue as I demonstrated above. However when I set currentTime from the DOM it's ok.
scratches head leave it with me, I'll report back in due course when I get to the bottom of this.
Thanks again

@amvd
Copy link

amvd commented Sep 1, 2020

I'm also having this issue on Firefox 80.0.1 and Svelte v3.24.0, macOS 10.15.6. Works fine in Chrome.

@quantumwebco
Copy link

quantumwebco commented Aug 20, 2021

I'm having this issue in
Chrome Version 92.0.4515.159 (Official Build) (64-bit)
"svelte": "^3.37.0"

I find that adding await tick(); solves this issue

    $: currentTime = 0;

    let jumpToTime = (nTimestamp) => {
        await tick();
        currentTime = nTimestamp;
        paused = false;
    };

    $: seconds = Math.floor(currentTime);

    $: if (seconds === 4) {
        jumpToTime(300);
    }

@llui85
Copy link

llui85 commented Oct 3, 2022

It looks like this issue still hasn't been fixed correctly unfortunately.

@tuzz
Copy link

tuzz commented Nov 7, 2023

I'm still seeing this issue in Firefox 119.0 on macOS Sonoma.

The workaround suggested by @quantumwebco worked for me:

tick().then(() => currentTime = newTime);

tuzz added a commit to beyondwords-io/player that referenced this issue Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants