(I thought I posted this already. I didn't see it in my own posts anymore, so in case it exists twice now, please help me remove the duplicate.)
The html5 specification seems to make using an Audio element straightforward:
- Code: Select all
<audio src="music.ogg" controls="controls"></audio>
(Not sure if it needs a closing tag, btw.)
Then maybe we want to add some fallback content:
- Code: Select all
<audio src="music.ogg" controls="controls">
<p>Listen to this!</p>
<p><a href="music.ogg" type="application/ogg">Music</a></p>
</audio>
And we may want to specify several media sources:
- Code: Select all
<audio controls="controls">
<source src="music.ogg" type="application/ogg"></source>
<source src="music.mp3" type="audio/mp3"></source>
<p>Listen to this!</p>
<p><a href="music.ogg" type="application/ogg">Music</a></p>
</audio>
Is this correct (apart from the unsupported mp3 type)?
Is fallback content for an audio element considered block or inline? I find the spec confusing on this point.
Does the source element require a closing tag? Again, I find the spec confusing.
One specific validator tells me that I've done several things wrong:
- The use of a P element (or any block level element for that matter) is not allowed inside an audio element
- Some required thing is missing from the audio element
Now, I didn't see anything required but for the src attribute or one or more child source elements. Thus the validator confuses me. Is the validator correct and am I missing something crucial? Or is the validator out of synch with the latest html5 spec?
Here's the page I tried to have validated:
http://www.omegajunior.net/muziek/dierendag.html