-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suspending and notifying resumption of a download for a media element fetching from a MediaSource #24
Comments
We need to understand the original issue better: is this something that becomes solved if we ignore the preload attribute for MSE (see issue 11). |
@wolenetz: Are you planning to produce a PR for this issue or should one of the other editors help here? |
I'm trying to understand still (now that #11 is figured out) if any work is necessary in V1 here.
In MSE, the web app, not the UA, determines when appendBuffer()/appendStream() are called. 'Text in the resource fetch algorithm that refers to "the download" or "bytes received" refer to data passed in via appendBuffer() and appendStream().' We could add some clarifying MSE spec text that references to transitions to NETWORK_IDLE and firing 'suspend' events, along with the entirety of the paragraph in the normatively referenced HTML5 spec for media-elements that begins "User agents may decide to not download more content at any time" is not involved in a media element that has a MediaSource attached, since the web app has control over this decision (and indeed can explicitly remove() buffered media or delay a repeated append if it receives QuotaExceededError on attempted appends (or an 'error' event fired at the SourceBuffer in the case of eviction failure in the stream append loop used by appendStream()) that fail to evict enough coded frames to make room for the new append).
Though buffer full flag might be set true during the segment parser loop, it can be cleared if coded frame eviction on the next appendBuffer or iteration of the stream append loop succeeds in freeing enough room in the buffer.
None of the above, IMO. 'suspending the download' is a 'may', and in the case of MSE, is not done by the UA. Rather, the MSE append*() operations define clearly when an append is either rejected or completed.
Initial transition to NETWORK_LOADING is 'loadstart'. And in MSE attachment case, 'sourceopen' is the "attachment success" signal for the web app to proceed with any addSourceBuffer() and appends as it desires. If I understand correctly, what is really being asked for here is an event and associated web-app-visible state that it can query which gives the web app the signal that "buffer full flag" is either not currently set or it might be clearable if the app wants to append some more. Note that this seems similar to #40, which is also currently VNext, not V1. Net: In V1, (from above): We could add some clarifying MSE spec text that references to transitions to NETWORK_IDLE and firing 'suspend' events, along with the entirety of the paragraph in the normatively referenced HTML5 spec for media-elements that begins "User agents may decide to not download more content at any time" is not involved in a media element that has a MediaSource attached, since the web app has control over this decision (and indeed can explicitly remove() buffered media or delay a repeated append if it receives QuotaExceededError on attempted appends (or an 'error' event fired at the SourceBuffer in the case of eviction failure in the stream append loop used by appendStream()) that fail to evict enough coded frames to make room for the new append). However, this is already a may in HTML spec, so this bug seems at most V1NonBlocking (for the MSE spec text clarification) and definitely VNext for the definition of some new API for signalling when an app might expect success for an append (with #40 also in VNext). @jdsmith3000 do you agree with this analysis and re-triage? |
Also, @karlt: are you the original bug filer for https://www.w3.org/Bugs/Public/show_bug.cgi?id=28573 ? |
Replaced with #24 (comment) so that quotes are not elided. |
One consequence of the removal of the optional steps of the
resource fetch algorithm that are sometimes associated with
preload=none (Issue #11), and proposed removal of the UA's option
to suspend would be that the load event is always blocked until
metadata has been appended to the MediaSource. I don't think that
would be desirable, and many of the web platform tests are not
expecting this.
|
Thanks, wolentz for CC'ing me on this. I am the original bug filer. I think the key issue to here for V1 is specifying when suspend karlt wrote:
wolentz writes:
Yes, but the UA decides whether the append succeeds.
If the intention is that NETWORK_IDLE and suspend events are never The option of QuotaExceedError on attempted append does allow the Are "stalled" events also suppressed? My impression is that the intention is that playing UI can
A "may" implies that the possibility is still there. When you exclude option (iv), which parts are not correct? After "Notify the media element that it now has all of the media "Once the entire media resource has been fetched (but potentially
"SourceBuffer is full" is determined by the UA, I assume.
Yes, I think that is required. The immediate issue is
Yes, "buffer full flag" change notification is similar. Issue #40 |
Marking V1 until and unless we can determine if this VNext (or fix it in V1). |
@jdsmith3000 I'm looking for other UA input here. Please reference the previous discussion and provide input on this issue. |
@karit, in #24 (comment):
Which 'load' event are you referring to? Even with MSE attachment, the 'loadstart' event should be queued without any delay in the resource selection algoirthm. The 'loadedmetadata' event should be queued once reaching HAVE_METADATA. And the 'loadeddata' should be queued the first time once reaching at least HAVE_CURRENT_DATA. |
On Fri, 20 May 2016 12:17:11 -0700, wolenetz wrote:
Here, I'm referring to the document load event, referenced at The delaying-the-load-event flag is set to true during the If it cannot be set to false "if the user agent intends to not i.e. the document load event would be delayed until the metadata Many web platform tests attach a MediaSource to a media element |
@karlt thanks for the detailed explanation around your wpt-related concern that, with MSE ignoring the optional 'preload=none' steps around 'suspend' or otherwise provide some 'suspend' logic in MSE context, that the delaying-the-load-event flag could remain true until the media element reaches HAVE_CURRENT_DATA. I see in Chromium at least, that the delaying-the-load-event-flag is set false when the 'stalled' event is queued. This accomodates MSE apps as well as regular src= whose loading has become stalled (which in both the MSE and src= cases can be detected by either lack of buffered range changes or bytes received over a period of time since the previous check for the 'progress' event when networkState is NETWORK_LOADING.) Notably, this Chromium logic for 'stalled' is somewhat close to the normatively-referenced w3c HTML5's spec text (and informatively-referenced w3c HTML5.1 spec text), with a relaxation of 'decides to completely stall a download' to something more like "detects a stall and queues a 'stalled' event":
Interestingly, this spec text doesn't say "When a user agent decides to suspend a download". Would it help to clarify in the MSE text that user agents must set the delaying-the-load-event-flag false when an HTMLMediaElement with MediaSource attached queues a 'stalled' event? This would align at least with Chromium's current implementation. |
wolenetz writes:
Thanks. This detail is helpful.
On my first investigation, I thought that relaxation might be That change was later reverted for regular sources, I agree with that comment and I don't think "stall" was We didn't get around to finding an appropriate solution for the
Yes, that changed due to
IMHO it seems a bit pointless to wait for the stalled event before However, delaying the load event is not desirable (IMO) and this In the HTML spec, suspend events correspond to the media element |
Proposed solution from today's editors' sync:
We even considered perhaps setting the delaying-the-load-event-flag false immediately upon MediaSource attachment to the HTMLMediaElement, but I'm not entirely certain that is correct. Chrome (and I think FF) already implement (2). Considering the scope of the agreed-upon spec changes, we retriaged this to V1NonBlocking today. |
We discussed further during today's editors' sync, with @travisleithead looped in. We don't need (2) from #24 (comment) and instead it is better to (3) just set the delaying-the-load-event-flag to false immediately upon MediaSource attachment to the HTMLMediaElement. Marking V1 to implement (1) and (3) accordingly. |
Migrated from w3c bugzilla tracker. For history prior to migration, please see:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28573
The text was updated successfully, but these errors were encountered: