Re: <video> attributes and children

On Mar 5, 2010, at 10:00 PM, Joe D Williams wrote:

> questions for <video>
>
> 1. Why does <video> not include @type and @media?
> If <source> uses/needs them, then why not <video> if only @src?
> If no <source> then @type and @media would not be present.

@type and @media are used to select from among multiple sources. It's  
not allowed to combine @src and <source>. So <video src> has only one  
possible source, and therefore there's no need for information that  
would be used to choose a source in that case.

> 2. Why would <source> (or <param>) include Global attributes?
> None are rendered and only the container really needs these.

Some global attributes, such as id, class, and data-*, definitely do  
make sense even on non-visible elements. For other global attributes,  
I expect it is more trouble than it's worth to make them specifically  
disallowed for non-visible elements.

>
> 3. Why does <video> @src empty or missing mean that <source> elements
> may be included?

@src and <source> are mutually exclusive.

>
> a src attribute, or zero or more source elements, followed by some or
> none flow content or phrasing content
>
> http://dev.w3.org/html5/spec/video.html#attr-media-src
>
> "There are two ways to specify a media resource, the src attribute, or
> source elements. The attribute overrides the elements."
>
> But if the attribute is present, <source> not conforming?

Correct.

> If the attribute is not present or empty, one or more <source> are
> conforming?.

Also correct.

> Sorry if I apparently hadn't looked at <video> in this detail before.
> I just thought it seemed natural that this was a two level fallback
> plan where is the <video> @src didn't play, then try <source> @src
> content in sequence and if still no go then show the flow or phrasing
> content.

That's not how it works. You can only use <video src> in the case  
where there is a single source. Otherwise you have to use <source>  
elements.

> Why doesn't the standard at least imply that the browser does anything
> 'automatic' in the fallback scheme?

The spec does say that the browser does something automatic, and in  
fact describes exactly what the browser is supposed to do: <http://dev.w3.org/html5/spec/Overview.html#concept-media-load-algorithm 
 >. Notice that if there is a src attribute, it always takes  
precedence. Otherwise, the <source> elements are tried in order.

> Are the <source> elements in there just so I can include some script
> to do fallback?

That's not the intent. Hopefully the above answers clarify how it works.

Regrds,
Maciej

Received on Saturday, 6 March 2010 06:39:05 UTC