Skip to content

Bug: media elements incorrectly fire seeking #4471

@mihar-22

Description

@mihar-22

Describe the bug
When bind:currentTime is added to a media element, if you simply play then pause the video a seeking event is fired. This occurs every toggle.

Logs
N/A

To Reproduce
https://svelte.dev/repl/366aaeab10304d11968cb72fe0896830?version=3.19.1

In the REPL simply open the console and toggle playback state on the audio player under the Fail heading.

Expected behavior
It should not fire the seeking event when toggling playback.

Stacktraces
N/A

Information about your Svelte project:

  • Browser: Chrome 80.0.3987.116
  • OS: OSX 10.15.1
  • Svelte: 3.19.1
  • Project uses both webpack and rollup.

Severity
Not severe. I'm in the process of building a video player with Svelte and I realized this odd behavior, it's easy to work around. I don't think in general it'll cause anyone trouble.

Additional context
I tried to fix it but JSDOM is limiting when running tests on a media element, so not sure if whatever I suggest will fix it or not. My guess is that on line 49 in Fail.svelte in the REPL, we need to check if the media element is paused again, otherwise the currentTime is updated one last time right after it is paused and it causes a seeking op.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions