New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 695065 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
no longer working on chrome
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Clicks at end of scrubber are buggy

Project Member Reported by joh...@chromium.org, Feb 22 2017

Issue description

Chrome Version: all

What steps will reproduce the problem?
(1) Visit https://mounirlamouri.github.io/sandbox/media/dynamic-controls.html
(2) (Optionally play some of the video then pause it again).
(3) Click slightly past the end of the scrubber's track (in order to exactly jump to the end).

What is the expected result?
Scrubber moves to end of track, and current time is updated to end of video.

What happens instead?
Scrubber moves to end of track, but current time is not updated, and pressing play to resume playback resumes from the unmodified current time (the scrubber jumps backwards).

Or if you do this whilst the video is playing, the scrubber will flicker to the end then immediately jump back to the current position.

This happens because https://codereview.chromium.org/614263002 ( issue 412562 ) made the scrubber only call mediaElement().setCurrentTime if the value of the underlying <input type="range"> is contained within the mediaElement().seekable() TimeRanges.

But the max value of the <input type="range"> seems to be rounded to 3 decimal places, for example this particular video has a duration of 596.58666700000003 but the max attribute ends up set to 596.58699999999999 which is slightly larger (0x1.2a4b17e77d524p+9 vs 0x1.2a4b22d0e5604p+9 to be precise, in "%a" hex floating point).

Hence when you try to seek to the end, the value of the <input type="range"> becomes the max attribute, which is not contained within the mediaElement().seekable() TimeRanges, and we ignore the seek (don't setCurrentPosition).
 

Comment 1 by joh...@chromium.org, Feb 22 2017

Summary: Clicks at end of scrubber are buggy (was: Click at end of scrubber are buggy)
Cc: mlamouri@chromium.org

Comment 3 by foolip@chromium.org, Feb 23 2017

It sounds like an optional strategy to https://codereview.chromium.org/614263002 could be to first clamp to the seekable ranges, and then seek only if the difference from currentTime is larger than some delta, say 100ms.
Project Member

Comment 4 by bugdroid1@chromium.org, Feb 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6d7ae217f9f1a7772046c5447f73bc8cdff8cbed

commit 6d7ae217f9f1a7772046c5447f73bc8cdff8cbed
Author: johnme <johnme@chromium.org>
Date: Tue Feb 28 20:34:12 2017

Media Controls: Fix seek to end when max attr is rounded up

When seeking to the end of an audio/video element, by clicking slightly
past the end of the track, sometimes the scrubber would move but the
current playing time wouldn't be updated.

This happened because https://codereview.chromium.org/614263002
( https://crbug.com/412562 ) made the scrubber only call
mediaElement().setCurrentTime if the |value| of the underlying
<input type="range"> is contained within the mediaElement().seekable()
TimeRanges.

But the |max| attribute of the <input type="range"> can sometimes be
rounded up slightly, for example a duration of 596.586667 results in a
|max| attribute of 596.587, and so seeking to this |max| value fails to
update currentTime.

This patch updates the seekable() contains check to take this floating
point error into account.

BUG= 695065 

Review-Url: https://codereview.chromium.org/2707043004
Cr-Commit-Position: refs/heads/master@{#453689}

[modify] https://crrev.com/6d7ae217f9f1a7772046c5447f73bc8cdff8cbed/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
[modify] https://crrev.com/6d7ae217f9f1a7772046c5447f73bc8cdff8cbed/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp

Labels: M-58
Status: Fixed (was: Started)
> It sounds like an optional strategy to https://codereview.chromium.org/614263002 could be to first clamp to the seekable ranges, and then seek only if the difference from currentTime is larger than some delta, say 100ms.

It seems that would suffer some of the problems discussed in  issue 412562 , e.g. dragging the scrubber whilst playing media that can only be seeked to the beginning would end up seeking to the beginning. I went with the safer option here of just clamping to mediaElement().duration(), which should already be closely aligned with max attribute of the range.
Good point, thanks for reminding me :)

Sign in to add a comment