[html5] HTMLMediaElement error state
zcorpan at gmail.com
Wed Jan 13 02:24:57 PST 2010
On Tue, 12 Jan 2010 21:52:04 +0100, Nathan Ziarek <nziarek at gmail.com>
> I hope I'm not being completely dense in looking at this.
> I placed a Windows Media Video as the source of my video element and
> opened it in Chrome / Safari / FireFox. My expectation was that the
> video element would have an error state of 3 (if I tried to trick it
> with a fake "type" attribute) or 4 and a networkState of 4.
> When used as the "src" attribute of the <video> element, the error
> state works as expected, while the networkState behaves differently
> between FireFox and WebKit. Obviously these elements are young, so
> differences are expected at this stage.
> The concern is when the <video> element is used with one or more
> <source> elements. If no <source> elements are playable, the error on
> the <video> element is NULL. As this is the same in all browsers and
> versions tested, and given the strict definition of HTMLMediaElement,
> I'm wondering if this is expected behavior?
Yes. The media element is still alive. If you were to insert another
<source> element with script, then the browser would try to play it.
> In my practical, real-world usage, it seems that if no suitable
> <source> is found, the error code and the error event should bubble up
> (I'm probably not using that terminology correctly) to the parent
> <video> element. Without that, I do not see a way to determine if the
> UA has determined there is nothing for it to display.
The error event on <source> doesn't bubble. You can set an event listener
on the last <source>. If the last <source> fails, then you know that all
others have also failed, since they are tried in order. (I think Firefox
doesn't yet fire error on <source>, but instead fires on <video>; Opera
10.50 pre-alpha should match the spec though.)
More information about the Help