[whatwg] Delaying the media load event

Matthew Gregan kinetik at flim.org
Wed May 27 05:16:46 PDT 2009


The load event for an image element fires once the image has been fetched,
is considered available (once it's known to be a supported type and the
image dimensions are known) and complete starts returning true.  So once
load fires, you can do useful things like paint the image into a canvas.

For a media element, the load event may fire before loadedmetadata and
loadeddata.  So load does not mean that it's possible to paint into a canvas
yet.

Does it make sense to delay the load event until after loadeddata is fired?
I don't have a particularly strong argument for doing this, other than:

- the document load event is delayed by media elements until loadeddata
  fires, so firing the media's load event earlier seems unusual

- it seems more consistent with the behaviour of image, and being less
  surprising is a nice property

Firefox's current implementation will not fire load before loadeddata.  This
happens because we deliberately delay load until after loadedmetadata, and
we fire loadedmetadata and loadeddata at the same time.

Cheers,
-mjg
-- 
Matthew Gregan                     |/
                                  /|                    kinetik at flim.org


More information about the whatwg mailing list