W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2008

[whatwg] HTMLMediaElement load and autoplay

From: Philip Jägenstedt <philipj@opera.com>
Date: Wed, 02 Jul 2008 19:09:35 +0700
Message-ID: <1215000575.7601.132.camel@localhost>
Keeping video discussion on the whatwg list as Firefox and Apple
implementors seem to be listening here...

I have some issues with the load method and when it is invoked.

http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#load

As far as I can see, there are 6 distinct ways that the method can be
invoked:

Immediate:
 - User invoked the DOM load() method
 - In the play() method, if the media element's networkState
   attribute has the value EMPTY
 - In the pause() method, if the media element's networkState
   attribute has the value EMPTY

As soon as all other scripts have finished executing:
 - If a media element whose networkState has the value EMPTY is
   inserted into a document
 - If the src attribute of a media element that is already in a
   document and whose networkState is in the EMPTY state is added,
   changed, or removed
 - If a source element is inserted into a media element that is
   already in a document and whose networkState is in the EMPTY
   state

It is not clear if the user agent should automatically invoke the load
method on media elements which are in the document's static markup. ??Is
it supposed to be implied by "media element ... inserted into a
document"? As far as I can tell, there is no other way the autoplay
mechanism could work.

If automatic loading is the intention, at what time is it supposed to
happen? I suggest: as soon as the DOM is in a consistent state, after
the DOMContentLoaded event is fired (where supported). The reason being
of course that media content isn't DOM content as such and
DOMContentLoaded shouldn't have to wait longer than necessary. I think
this is the best option, as it is consistent -- load is always invoked
automatically irrespective of if the media element was in the markup or
inserted via DOM.

If user agents don't want to waste time downloading video that isn't
visible (e.g. due to CSS "display:none") they can block the download
(step 14 of the load algorithm) until it becomes visible. In this
situation, does the spec allow firing the stalled event immediately
instead of waiting 3 seconds?

Since "faking it" is allowed, script authors should be aware that
loading media (at least video) in the background isn't going to work.
I'm not sure if this might be a problem, but if it is I expect we could
cater to that need by making an explicit load() to cause the user agent
to rush to CAN_PLAY as fast as possible without fake-stalling.

Any ideas on this? This might be nit-picking, but consistency across
browsers would be nice if possible.

-- 
Philip J?genstedt
Opera Software
Received on Wednesday, 2 July 2008 05:09:35 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:03 UTC