[whatwg] <video> resource selection algorithm and NETWORK_NO_SOURCE

Philip Jägenstedt philipj at opera.com
Wed Jul 28 01:59:13 PDT 2010


On Wed, 28 Jul 2010 01:10:07 +0200, Silvia Pfeiffer  
<silviapfeiffer1 at gmail.com> wrote:

> On Tue, Jul 27, 2010 at 6:17 PM, Philip Jägenstedt  
> <philipj at opera.com>wrote:
>
>> On Tue, 27 Jul 2010 00:01:26 +0200, Silvia Pfeiffer <
>> silviapfeiffer1 at gmail.com> wrote:
>>
>>  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.
>>>
>>
>> Yes, but it shouldn't work, and will stop working as soon as they  
>> implement
>> the new resource selection algorithm. It is very important that authors
>> don't depend on this bug, so I hope you'll change any code where you  
>> have
>> accidentally done so.
>
>
>
> I don't see a reason why it shouldn't work. What is the logic behind  
> that?
>
> I believe the spec should specify what authors should reasonably expect  
> to
> work. I think this is a case that should reasonably be expected to work.  
> If
> the spec doesn't currently allow it, but browsers have implemented it -  
> so
> it is possible to make it work - then I don't see a reason why the spec
> shouldn't be adapted to work as implementations work and as users/authors
> expect it to work.

I'm just saying that it shouldn't work if implementations follow the spec.  
I don't think that it *not* working is a feature, but I also don't think  
that making it work is very important. In the example the markup was  
invalid, so if the spec doesn't make it work perfectly I'm OK with that.  
Furthermore, once it stops working in all browsers authors will learn to  
add a call to load() after they are done modifying the attributes of  
source elements. If it turns out that this is something many authors get  
stuck on then maybe we can add more triggers for src, type and media  
attributes on source elements.

-- 
Philip Jägenstedt
Core Developer
Opera Software


More information about the whatwg mailing list