[whatwg] <source>

Maciej Stachowiak mjs at apple.com
Fri Mar 23 13:47:01 PDT 2007


On Mar 23, 2007, at 5:36 AM, Anne van Kesteren wrote:

> I don't really like this element. The name is confusing especially  
> with an attribute named src="". It also introduces yet another void  
> element, can't we just reuse <param>? The value="" attribute of  
> <param> would point to a resource and the type="" attribute (which  
> has been dropped) would be added back. I suppose it might be  
> considered overloading, but in a way we're just defining how the  
> processing model of a plugin could also work...

So to be sure I understand your proposal, you're suggesting that  
instead of

<source type="audio/mpeg" src="mysong.mp3">

You'd say:

<param type="audio/mpeg" value="mysong.mp3">

I think the latter is a lot less clear. Also, <param> would end up  
having two uses which differ in the following ways:

1) Do you have type/value or name/value as allowed attributes?
2) Which object can contain it?
3) Do you process all of them, or only the first one to match some  
criteria?

They would effectively be different elements since the processing  
model and criteria for a valid document would differ.

I agree the repetition of source/src is a little weird. Another  
possibility that was discussed is to still have the type attribute on  
audio/video, and let it be the first item considered for fallback,  
and name the new element something like <alt> so you could write:

<audio type="audio/mpeg" src="mysong.mp3">
   <alt type="audio/x-aiff" src="mysong.aif">
   <alt type="audio/wav" src="mysong.wav">
</audio>

Or, if you want symmetry:

<audio>
   <alt type="audio/mpeg" src="mysong.mp3">
   <alt type="audio/x-aiff" src="mysong.aif">
   <alt type="audio/wav" src="mysong.wav">
</audio>

One nice thing about using <alt> is that it makes it more clear that  
only one source will apply. Another nice thing about it is that it  
could more naturally be extended to supporting playlists, where a  
single element is declaratively set up to play multiple media files  
(this is better than using script for this, since you can start  
buffering the second and subsequent files early).

<audio>
     <li>
       <alt type="audio/mpeg" src="mysong.mp3">
       <alt type="audio/x-aiff" src="mysong.aif">
       <alt type="audio/wav" src="mysong.wav">
     </li>
     <li>
       <alt type="audio/mpeg" src="othersong.mp3">
       <alt type="audio/x-aiff" src="othersong.aif">
       <alt type="audio/wav" src="othersong.wav">
     </li>
</audio>

Perhaps reusing <li> like that is too cute and there should be some  
more specific element for a playlist item. But I guess you could use  
this syntax with <source> just as well.

Regards,
Maciej








More information about the whatwg mailing list