Bug 184094 - Video does not leave seeking state after seeking to duration
Summary: Video does not leave seeking state after seeking to duration
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari Technology Preview
Hardware: Macintosh Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2018-03-28 10:12 PDT by Theodore Abshire
Modified: 2018-04-02 11:08 PDT (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Theodore Abshire 2018-03-28 10:12:18 PDT
When playing some assets, loaded via the MediaSource API (but not via src=), if you seek to the video's duration the video never leaves the seeking state.
If you tab away from Safari and come back, sometimes it will begin playing over again.

I have created a minimal reproduction page for this bug:
Just open the web console and press the "begin test" button.

After seeking (and waiting for a few seconds to give it reasonable time to complete the process of seeking), the video's "seeking" property is true, "ended" is true, and "paused" is false.
I've tried this a few times and it seems quite consistent. I've tried it with Safari 11.0.3 and with Safari Technology Preview (11.2), and it happens with both. Sometimes if I tab away for a while and come back to Safari, the video has restarted.

There do not seem to be similar issues on Chrome or Firefox. This also doesn't apply to every asset; I've only seen it thus far with the asset in the test page (and another asset that I've left commented out in the source, if you care to make comparisons).
Comment 1 Radar WebKit Bug Importer 2018-03-28 15:33:11 PDT
Comment 2 Jer Noble 2018-04-02 11:08:32 PDT
The basic problem is that the "buffered time" ranges are [inclusive,exclusive). So while the buffered range is [0,60.0), a seek to 60.0 will fail because it is technically outside the buffered range.

The last sample (in both PTS and DTS order) has a display time of 767488/12800 (or 59.96) and a duration of 512/12800 (or 0.04). So a seek to 60.0 is to a time where there is no displayable sample.

That said, the stream is marked as "ended", and perhaps the last sample should be considered to have an infinite duration for the purposes of being "displayable".