Can't seek to end of video

RESOLVED FIXED in Firefox 38

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: jya, Assigned: jya)

Tracking

(Blocks 1 bug)

Trunk
mozilla39
x86
macOS
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox37 wontfix, firefox38 fixed, firefox39 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

Assignee

Description

4 years ago
This may be a regression

http://people.mozilla.org/~jyavenard/tests/mse_mp4/seektoend.html?eos=1&eosat=-1&duration=-1&init=0

Attempting to seek to the end of the video element using:
video.currentTime = video.duration

will never complete.
the seeking event is fired.

However seeked event is never fired, (nor will "ended")

Expected behaviour:
"seeked" and "ended" event to be fired.
Assignee

Updated

4 years ago
Blocks: MSE
Assignee

Comment 1

4 years ago
From spec:
http://www.w3.org/html/wg/drafts/html/master/semantics.html#dom-media-seek

"Set the current playback position to the new playback position.

Note. If the media element was potentially playing immediately before it started seeking, but seeking caused its readyState attribute to change to a value lower than HAVE_FUTURE_DATA, then a waiting event will be fired at the element.

Note. This step sets the current playback position, and thus can immediately trigger other conditions, such as the rules regarding when playback "reaches the end of the media resource" (part of the logic that handles looping), even before the user agent is actually able to render the media data for that position (as determined in the next step)."

The second note describes what to do should we reach the end of the media resource
http://www.w3.org/html/wg/drafts/html/master/semantics.html#reaches-the-end

So we should assume that the seek has completed and we've reached the end.

Chrome has the proper behaviour.
IE never fire ended
(In reply to Jean-Yves Avenard [:jya] from comment #1)
> From spec:
> http://www.w3.org/html/wg/drafts/html/master/semantics.html#dom-media-seek

Just FYI you should look at https://html.spec.whatwg.org/multipage/ , not the w3c's slighty-buggy-and-out-of-date mirror of it.

But yes, this sounds like a bug.
Assignee

Updated

4 years ago
Blocks: 1143971
Assignee

Comment 3

4 years ago
Add MediaDecoder::IsLiveStream() method. MediaSourceResource returns -1 which always make the MDSM considers that it's a live stream and never issue the ended event after a seek
Attachment #8580484 - Flags: review?(cpearce)
Assignee

Updated

4 years ago
Assignee: nobody → jyavenard
Status: NEW → ASSIGNED
Assignee

Comment 4

4 years ago
When seeking to the end of the mediasource duration, we would have stalled as the mPendingSeekTime would never be in the buffered range. So instead, we seek to the last of the audio sample and the last video sample. The MDSM seek logic will hit an end of stream and 
automatically complete the seek as required.
Attachment #8580498 - Flags: review?(matt.woodrow)
Attachment #8580498 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8580484 [details] [diff] [review]
Part1. Add MediaDecoder::IsLiveStream() API

Review of attachment 8580484 [details] [diff] [review]:
-----------------------------------------------------------------

It's a shame we can't stick a IsLiveStream() function on the MediaResource instead.
Attachment #8580484 - Flags: review?(cpearce) → review+
Assignee

Comment 6

4 years ago
(In reply to Chris Pearce (:cpearce) from comment #5)
> Comment on attachment 8580484 [details] [diff] [review]
> Part1. Add MediaDecoder::IsLiveStream() API
> 
> Review of attachment 8580484 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> It's a shame we can't stick a IsLiveStream() function on the MediaResource
> instead.

We could. A tad more work however, but nothing significant I don't think.
Assignee

Comment 7

4 years ago
v2: Add MediaResource::IsLiveStream(). I added a monitor to set it. In practice, no race can occur as we won't complete the seek until the stream is ended and if a race does occur it's nothing serious. Also, setting and reading a boolean is atomic with most platforms. But just in case this method is used elsewhere. But just for the clarity of things. as MediaSourceResource::mEnded is accessed from two different threads.
Attachment #8581363 - Flags: review?(cpearce)
Assignee

Updated

4 years ago
Attachment #8580484 - Attachment is obsolete: true
Attachment #8581363 - Flags: review?(cpearce) → review+
https://hg.mozilla.org/mozilla-central/rev/5a6798098985
https://hg.mozilla.org/mozilla-central/rev/6604e8d39fc6
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Assignee

Comment 10

4 years ago
This only made us more spec compliant, but other piece of code relies on that behaviour to be correct to properly behave themselves.
Flags: needinfo?(giles)
Comment on attachment 8580498 [details] [diff] [review]
Part2. Allow seek to end of mediasource.duration

Requesting 38 uplift for both patches on this bug.

Approval Request Comment
[Feature/regressing bug #]: MSE
[User impact if declined]: Possible stalls after seeking, spec compliance.
[Describe test coverage new/current, TreeHerder]: Landed on m-c.
[Risks and why]: Change is isolated to MSE code.
[String/UUID change made/needed]: None.
Flags: needinfo?(giles)
Attachment #8580498 - Flags: approval-mozilla-aurora?
Attachment #8581363 - Flags: approval-mozilla-aurora?
Attachment #8580498 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #8581363 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.