This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26873 - MediaController: emptied event
Summary: MediaController: emptied event
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard: blocked awaiting response from Silvia...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-21 00:56 UTC by Silvia Pfeiffer
Modified: 2016-02-01 02:52 UTC (History)
4 users (show)

See Also:


Attachments

Description Silvia Pfeiffer 2014-09-21 00:56:42 UTC
https://html.spec.whatwg.org/#event-mediacontroller-emptied

The following events fire on MediaController objects:
...
emptied -
	All the slaved media elements newly have readyState set to HAVE_NOTHING or greater, or there are no longer any slaved media elements.
...

Seems out of whack with the same named event on MediaElement objects:
...
emptied -
	A media element whose networkState was previously not in the NETWORK_EMPTY state has just switched to that state (either because of a fatal error during load that's about to be reported, or because the load() method was invoked while the resource selection algorithm was already running).
	networkState is NETWORK_EMPTY; all the IDL attributes are in their initial states.
...

Shouldn't emptied be about NETWORK_EMPTY? At least it should not include any readyState greater than HAVE_NOTHING.
Comment 1 Ian 'Hixie' Hickson 2014-09-22 16:39:27 UTC
Are you asking if the non-normative text you quote is accurate, or are you asking if the normative text corresponding to the non-normative text you quote should be changed?

If the former, it seems accurate to me.

If the latter, what proposed changes to the normative text did you have in mind?
Comment 2 Silvia Pfeiffer 2014-09-22 22:13:53 UTC
The former - the latter is accurate FAIK.

I think that at least one media element needs to newly have a readyState set to HAVE_NOTHING to raise this event.

Instead, the current description implies to raise a emptied event also every time all slaved media elements newly have a readyState set to something greater than HAVE_NOTHING.
Comment 3 Ian 'Hixie' Hickson 2014-09-23 18:24:42 UTC
Can you walk me through your reading of the spec that leads you to conclude that the HAVE_* states are relevant to when a MediaController fires 'emptied'?

Or are you the description of the event as a description of the proximate cause of the event firing? It's not a description of the cause of it firing, it's a description of the state of the world when it fires. "When the engine light comes on, the engine needs examining" doesn't mean "when the engine needs examining, the engine light comes on".
Comment 4 Silvia Pfeiffer 2014-11-03 10:19:22 UTC
Here's what I think the MediaController's "emptied" event description at https://html.spec.whatwg.org/#event-mediacontroller-emptied should say:
...
emptied -
	At least one of the slaved media elements newly has readyState set to HAVE_NOTHING, or there are no longer any slaved media elements.
...

Alternatively, it could also be defined as:
...
emptied -
	At least one of the slaved media elements whose networkState was previously not in the NETWORK_EMPTY state has just switched to that state, or there are no longer any slaved media elements.
...


Here's my reading of the spec that confirms this:
https://html.spec.whatwg.org/#most-recently-reported-readiness-state

Let all slaved media elements have a readyState of "HAVE_METADATA".
Call load() on one slaved media element (https://html.spec.whatwg.org/#dom-media-load), which raises an emptied event and sets the element's readyState to "HAVE_NOTHING".
This in turn requires reporting the controller state for the media element's current media controller (https://html.spec.whatwg.org/#ready-states).

Calculating the new readiness state of the MediaController (https://html.spec.whatwg.org/#report-the-controller-state) says to take "the lowest value of the readyState IDL attributes of all of its slaved media elements", which is 0.

And further: "if the MediaController's most recently reported readiness state is greater than new readiness state then queue a task to fire a simple event at the MediaController object, whose name is the event name corresponding to the value of new readiness state given in the table below."

Thus: a emptied event is raised at the MediaController.
Comment 5 Anne 2015-09-02 08:16:07 UTC
Silvia, would you be interested in providing a PR at https://github.com/whatwg/html for this improvement?
Comment 6 Philip Jägenstedt 2016-02-01 02:52:28 UTC
Won't fix, see https://github.com/whatwg/html/issues/192