- From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
- Date: Tue, 27 Jul 2010 08:01:26 +1000
On Tue, Jul 27, 2010 at 1:37 AM, Philip J?genstedt <philipj at opera.com>wrote: > On Mon, 26 Jul 2010 16:53:43 +0200, Silvia Pfeiffer < > silviapfeiffer1 at gmail.com> wrote: > > On Mon, Jul 26, 2010 at 11:25 PM, Philip J?genstedt <philipj at opera.com >> >wrote: >> >> <video controls width="400px"> >>> </video> >>> <script type="text/javascript"> >>> var video = document.querySelector("video"); >>> var exts = ["mp4", "webm", "ogv"]; >>> exts.forEach(function(ext) { >>> var source = document.createElement("source"); >>> source.src = "HelloWorld."+ext; >>> source.type = "video/"+ext; >>> video.appendChild(source); >>> }); >>> video.play(); >>> </script> >>> >>> >> >> Does this actually work in Opera now? >> > > 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. 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. 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: > > exts.forEach(function(ext) { > if (video.canPlayType("video/"+ext)) { > video.src = "movie_300."+ext; > return false; > } > }); > I expect this will be interoperable right now and it's easier to understand > exactly what's going on. > 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? > 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. 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. Cheres, Silvia. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100727/1451efdf/attachment.htm>
Received on Monday, 26 July 2010 15:01:26 UTC