Clicks at end of scrubber are buggy |
|||
Issue descriptionChrome 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).
,
Feb 22 2017
,
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.
,
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
,
Mar 1 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. 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.
,
Mar 3 2017
Good point, thanks for reminding me :) |
|||
►
Sign in to add a comment |
|||
Comment 1 by joh...@chromium.org
, Feb 22 2017