On Tue, Jul 27, 2010 at 1:37 AM, 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;">
<div><div></div><div class="h5">On Mon, 26 Jul 2010 16:53:43 +0200, Silvia Pfeiffer <<a href="mailto:silviapfeiffer1@gmail.com" target="_blank">silviapfeiffer1@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Mon, Jul 26, 2010 at 11:25 PM, Philip Jägenstedt <<a href="mailto:philipj@opera.com" target="_blank">philipj@opera.com</a>>wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<video controls width="400px"><br>
</video><br>
<script type="text/javascript"><br>
var video = document.querySelector("video");<br>
var exts = ["mp4", "webm", "ogv"];<br>
exts.forEach(function(ext) {<br>
var source = document.createElement("source");<br>
source.src = "HelloWorld."+ext;<br>
source.type = "video/"+ext;<br>
video.appendChild(source);<br>
});<br>
video.play();<br>
</script><br>
<br>
</blockquote>
<br>
<br>
Does this actually work in Opera now?<br>
</blockquote>
<br></div></div>
Yes, when I have a HelloWorld.webm file available it starts playing. It also works in Firefox 4b1 and it should work in Chrome and Safari too unless they are buggy.</blockquote><div class="im"><br><br>Right, so it works if you create the <source> elements newly, but it still doesn't work when you have previously created the <source> element just with an empty @src attribute (which I think is legal). Both of these work in all the other browsers, btw.<br>
<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Right, I realize there are actually situations where it isn't a pointless exercise as in the above. If you're already using scripts, though, you could actually call canPlayType yourself and use the first one that works:<br>
<br>
exts.forEach(function(ext) {<br>
if (video.canPlayType("video/"+ext)) {<br>
video.src = "movie_300."+ext;<br>
return false;<br>
}<br>
}); </blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
I expect this will be interoperable right now and it's easier to understand exactly what's going on.<br></blockquote><div><br><br>Yes, it is and works in all browsers. But I still see it as a bug if you're not allowed to change the @src on the <source> elements and get the video reloaded. Why would @src on <source> elements be mutable in the first place then?<br>
<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Looking again at the resource selection algorithm, the second step is to await a stable state, i.e. wait until the current script has finished. Given that, it wouldn't be a big problem to let modification of src attributes on source elements trigger resource selection, you won't get the 3-2-1 problem I mentioned earlier. However, then I would argue that modifying type and media should also have the same effect, as those affect the outcome of resource selection. In the end, my suggestion is still no spec change, except for editorial changes to clarify.</blockquote>
<br>No matter what we call it, there is currently no mention of @src change (and indeed @type and @media change) on <source> to cause resource selection and this has caused diverging implementations in browsers. A clarification is certainly necessary.<br>
<br>Cheres,<br>Silvia.<br><br><br></div>