error events for unsupported <source>s

Currently the spec says to fire an error event in the Waiting step of the resource selection algorithm:

   Waiting: Set the error attribute to a new MediaError object whose code
   attribute is set to MEDIA_ERR_NONE_SUPPORTED.
    -- http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#concept-media-load-algorithm


This means that given the following:

   <video>
    <!-- network pause -->
    <source src=1>
    <!-- network pause -->
    <source src=2>

Consider that 2 would be of a supported format and 1 is not -- you would get two error events with error.code being MEDIA_ERR_NONE_SUPPORTED. This seems suboptimal, especially since it would depend on the network.

It seems more predictable and useful to fire an error event at the media element at the point you find a <source> (or <video src>) that is not supported. (Also more consistent with <img> -- without a src="" you don't get an error event.) error.code could say MEDIA_ERR_NOT_SUPPORTED instead, and the MediaError interface could gain another attribute (say error.src) that is set to the value of .currentSrc at the time the error occurred. (Since the algorithm is async authors can't just look at .currentSrc since it might have changed before the event handler looks at it.)


Thoughts?

-- 
Simon Pieters
Opera Software

Received on Tuesday, 10 March 2009 11:56:12 UTC