J'ai eu des problèmes avec Firefox parce que j'avais seulement un fichier mp4, mais ce javascript semble fonctionner correctement.
La nouvelle étiquette vidéo est utilisée et le code objet est fourni en tant que solution de repli. Lorsque Firefox ne trouve pas le fichier ogv inexistant, il lance une erreur, qui exécute le javascript pour supprimer la balise vidéo et laisse juste le code objet de repli, qui fonctionne bien dans Firefox. (J'utilise JQuery, mais la même chose pourrait vraisemblablement être réalisée avec du javascript simple.)
<script type="text/javascript">
function kill_video_tag() {
// Remove source tags
$('#vidid').children('source').remove();
// Grab everything else inside
var ob = $('#vidid').html();
// Add the fallback code before the video tag
// and then remove the video tag
$('#vidid').before(ob).remove();
}
</script>
<video id="vidid" width="320" height="256" controls>
<source src="http://www.mysite.com/nice_video.mp4" type="video/mp4" />
<source src="http://www.mysite.com/this_does_not_exist.ogv" type="video/ogg" onerror="kill_video_tag();" />
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="320" HEIGHT="256" >
<PARAM NAME="src" VALUE="http://www.mysite.com/nice_video.mp4" >
<PARAM NAME="autoplay" VALUE="false" >
<EMBED SRC="http://www.mysite.com/nice_video.mp4" TYPE="image/x-macpaint" PLUGINSPAGE="http://www.apple.com/quicktime/download" WIDTH="320" HEIGHT="256" AUTOPLAY="false"></EMBED>
</OBJECT>
</video>