<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 23, 2010, at 7:16 AM, Philip Jägenstedt wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Silvia made we aware of discrepancy in how browsers implement the resource selection algorithm, see forwarded message. It's my assessment that Opera is the only browser following the spec. I've filed this bug with Mozilla:<br><br><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=581355">https://bugzilla.mozilla.org/show_bug.cgi?id=581355</a><br><br>I've also reported bugs in Chrome and Safari, but can't see where they ended up.<br><br>The reason I'm writing this email is that apparently everyone but myself has a different interpretation of the spec, so perhaps this is something we need to discuss. Does any other browser ever set the state NETWORK_NO_SOURCE at all? I speculated that perhaps other browsers aren't very strict about which parts of the algorithm are run synchronously and not, but even checking the networkState after a setTimeout it still isn't NETWORK_NO_SOURCE.<br><br>Test case: http://people.opera.com/philipj/2010/07/23/networkState.html<br><br>Please fix implementation or spec :)<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>1) Which behavior is more useful?</div><div>2) Sylvia's original issue was with play() - should we ensure that any time you call play(), it will cause the media resource to start playing once loaded? That seems like the real spec bug.</div><div><br></div><div>Regards,</div><div>Maciej<br><div><br></div><br><blockquote type="cite"><div>-- <br>Philip Jägenstedt<br>Core Developer<br>Opera Software<br><br>------- Forwarded message -------<br>From: "Silvia Pfeiffer" <<a href="mailto:silviapfeiffer1@gmail.com">silviapfeiffer1@gmail.com</a>><br>To: "Philip Jägenstedt" <<a href="mailto:philipj@opera.com">philipj@opera.com</a>><br>Cc:<br>Subject: Re: bug in Opera video<br>Date: Thu, 22 Jul 2010 12:51:15 +0200<br><br>Hi Philip,<br><br>On Thu, Jul 22, 2010 at 8:02 PM, Philip Jägenstedt <<a href="mailto:philipj@opera.com">philipj@opera.com</a>><br>wrote:<br><blockquote type="cite">On Thu, 22 Jul 2010 01:23:09 +0200, Silvia Pfeiffer<br></blockquote><blockquote type="cite"><<a href="mailto:silviapfeiffer1@gmail.com">silviapfeiffer1@gmail.com</a>> wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Philip,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I've just made an experiment with the play() function in Opera and it<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">seems that Opera doesn't support play() if currentSrc has not been<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">determined yet (i.e. if the media element doesn't have a loaded<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">resource). The spec says to deal with this situation and so do all<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">other browsers, bar Opera. Here is a test:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><!DOCTYPE html><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><html lang="en"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <body><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <video controls width="400px"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <source type="video/mp4"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <source type="video/webm"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <source type="video/ogg"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> </video><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <p>currentSrc on start: <span id="currentSrc_first"></span>.</p><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <p>currentSrc after loadedmetadata: <span<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">id="currentSrc_loadedmetadata"></span>.</p><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <script type="text/javascript"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> video = document.getElementsByTagName("video")[0];<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> source = document.getElementsByTagName("source");<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> span1 = document.getElementById("currentSrc_first");<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> span1.innerHTML = video.currentSrc;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> source[0].src = "HelloWorld.mp4";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> source[1].src = "HelloWorld.webm";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> source[2].src = "HelloWorld.ogv";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> video.play();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> span2 = document.getElementById("currentSrc_loadedmetadata");<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> function span2Update(evt) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> span2.innerHTML = video.currentSrc;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> }<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> video.addEventListener("loadedmetadata", span2Update, false);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> </script><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> </body><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"></html><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The video.play() function should execute the resource selection and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">fetching, but it doesn't. Not sure if this is deliberate and you want<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">a discussion on the whatwg about it, or just a bug.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Cheers,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Silvia.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The spec says "If the media element's networkState attribute has the value<br></blockquote><blockquote type="cite">NETWORK_EMPTY, invoke the media element's resource selection algorithm."<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I added alert(video.networkState) just before video.play. In Opera it is 3<br></blockquote><blockquote type="cite">(NETWORK_NO_SOURCE) while in Chrome it is 0 (NETWORK_EMPTY).<br></blockquote><br>Ah, yes, this is actually another thing I wanted to alert you to. All<br>other browsers set the @networkState to NETWORK_EMPTY at the start of<br>loading a new media resource (Firefox, Safari and Chrome). I was going<br>to discuss this with you, since Opera interprets the spec different<br>here - which is understandable, since the first step in the resource<br>selection algorithm says to:<br>1. Set the networkState to NETWORK_NO_SOURCE.<br><br>OTOH however, the description for the NETWORK_NO_SOURCE state is as<br>follows:<br>NETWORK_EMPTY (numeric value 0)<br> The element has not yet been initialized. All attributes are in<br>their initial states.<br>and for NETWORK_NO_SOURCE is:<br>NETWORK_NO_SOURCE (numeric value 3)<br> The element's resource selection algorithm is active, but it has<br>failed to find a resource to use.<br><br>Thus, I believe this may be a spec bug and really the first step in<br>the resource selection algorithm should say<br>1. Set the networkState to NETWORK_EMPTY.<br>which is more consistent with the implementations of the other<br>browsers and also consistent with the meaning of NETWORK_EMPTY and<br>NETWORK_NO_SOURCE.<br><br><br><blockquote type="cite">We are<br></blockquote><blockquote type="cite">following the spec here, as the resource selection algorithm should be run<br></blockquote><blockquote type="cite">the first time when the video element is inserted into the DOM by the<br></blockquote><blockquote type="cite">parser, then again after each source element is inserted. For this markup,<br></blockquote><blockquote type="cite">it will stay as NETWORK_NO_SOURCE in all cases, which is basically a waiting<br></blockquote><blockquote type="cite">state.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">There are a few ways we could go about solving this:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">1. Make modifying the src attribute of source elements that are children to<br></blockquote><blockquote type="cite">a video element that has state EMPTY or NO_SOURCE run the resource selection<br></blockquote><blockquote type="cite">algorithm. I don't like this idea myself, it's unnecessarily complicated.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">2. Let the other browsers follow the spec and add a call to video.load()<br></blockquote><blockquote type="cite">before video.play().<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Please do bring this up with the WHATWG. If you like you can forward this<br></blockquote><blockquote type="cite">mail verbatim. To anyone testing this, note that HelloWorld.mp4 has to<br></blockquote><blockquote type="cite">actually exist (or changed to something that does) for the above test to<br></blockquote><blockquote type="cite">work.<br></blockquote><br>Actually, in cases where it doesn't exist, all other browsers can deal<br>with it, but Opera hangs. I have actually posted that to Opera bug<br>reports if you want to follow up on this, too.<br><br>I'm leaving it to you to bring it up at WHATWG, since it seems that<br>the Opera implementation is the odd one out. :-)<br><br>Cheers,<br>Silvia.<br></div></blockquote></div><br></body></html>