On Mon, Jul 26, 2010 at 7:41 PM, Philip Jägenstedt <span dir="ltr"><<a href="mailto:philipj@opera.com">philipj@opera.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I actually don't think there's anything wrong about the spec as it is.<br>
<br>
NETWORK_NO_SOURCE is not a state of failure, it is a waiting state. Here's what happens as the parser inserts elements into the DOM:<br>
<br>
<video controls width="400px"><br>
<!-- video has been inserted but resource selection hasn't run --><br>
  <source type="video/mp4"><br>
<!-- resource selection is started, ends on step 21 with NETWORK_NO_SOURCE and pointer pointing to just after the only source element --><br>
  <source type="video/webm"><br>
<!-- resource selection continues at step 22, going another loop and ending at step 21, but with pointer pointer to after the second source element --><br>
  <source type="video/ogg"><br>
<-- same as above, but pointing to after the third source element --><br>
</video><br>
<br>
If nothing is done, the resource selection algorithm will wait forever at step 21. To get out of that state you have to either call load() to restart resource selection, or append another source element.<br>
<br>
If we should let networkState be NETWORK_EMPTY after inserting the dummy <source> elements, then resource selection would be run from the beginning each time, which means that during parsing, the first <source> element will be considered 3 times, the second 2 times and the last 1 time. In your example this doesn't matter, but if the reason a <source> failed was because of network errors, unsupported Content-Type or an unsupported file format, then that will also happen too many times, adding useless network traffic (unless e.g. 404 results are cached).<br>


<br>
So, I think the algorithm should stay as it is and that the other browsers should change their implementations. In your original example you used <source> elements with no src attribute. This is invalid, and I think the proper solution would be to create each source element, set the src attribute and append it to the video element.<br>

</blockquote></div><br>Ok, I re-read the spec about <source> and you are correct: it's invalid to create <source> elements without a @src attribute. It could, however, still be created without a URI, in which case the resulting state would indeed be a NETWORK_NO_SOURCE, since it fails to find a valid @currentSrc .<br>

<br>I still think, though, that NETWORK_NO_SOURCE is a failure state, since it is specified as<br>NETWORK_NO_SOURCE (numeric value 3):<br>
     The element's resource selection algorithm is active, but it has failed to find a resource to use.<br><br><br>I now wonder about the intention of play() (and also of pause()). As I understood it, they are both meant to reload the media resource if @currentSrc has changed, similar to what load() is supposed to do.<br>

<br>Also, I wonder what NETWORK_EMPTY is used for when not at the beginning of parsing the media resource. I haven't managed to catch Opera in that state.<br><br>Cheers,<br>Silvia.<br><br>