Let’s say you wanted to provide audio in both Ogg Vorbis and MP3 formats to support
Firefox, Chrome, Opera, Safari, and IE9. You can do this by using the source
element in conjunction with the audio element. The code would look like this:
It couldn’t be easier!
Naturally, you can add a WAV file format too (should you want to):
making whichever source the browser chooses to play automatically would simply
require this code:
the same tactic, but the fallback is different.
<audio controls>
<source src=”sayHello.ogg” type=”audio/ogg”>
<source src=”sayHello.mp3” type=”audio/mp3”>
</audio>
It couldn’t be easier!
Naturally, you can add a WAV file format too (should you want to):
<audio controls>You can incorporate any of the attributes mentioned earlier here as well. So
<source src=”sayHello.ogg” type=”audio/ogg”>
<source src=”sayHello.mp3” type=”audio/mp3”>
<source src=”sayHello.wav” type=”audio/wav”>
</audio>
making whichever source the browser chooses to play automatically would simply
require this code:
<audio controls autoplay>To support browsers that don’t support the HTML5 audio element, you’d follow
<source src=”sayHello.ogg” type=”audio/ogg”>
<source src=”sayHello.mp3” type=”audio/mp3”>
<source src=”sayHello.wav” type=”audio/wav”>
</audio>
the same tactic, but the fallback is different.