Created
May 21, 2010 21:04
-
-
Save banterability/409431 to your computer and use it in GitHub Desktop.
html5 with a fallback for mp3-hating firefox with a fallback to flash with a fallback to a link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="html5audio"> | |
<div id="no-ogg" style="display:none;"> | |
<div id="flash-player"> | |
<a href="foo.mp3">Download Audio</a> | |
</div> | |
</div> | |
<audio controls> | |
<source src="foo.mp3" type="audio/mpeg" /> | |
<div id="flash-player"> | |
<a href="foo.mp3">Download Audio</a> | |
</div> | |
</audio> | |
</div> | |
<script type="text/javascript" charset="utf-8"> | |
function embedFlash(){ | |
var flashvars = {}; | |
// define flashvars | |
var params = {}; | |
// define params | |
var attributes = {}; | |
// define attributes | |
swfobject.embedSWF("player.swf", "flash-player", "180", "14", "9.0.0", false, flashvars, params, attributes); | |
} | |
$(document).ready(function() { | |
if ($.browser.mozilla){ | |
$('audio').remove(); | |
$('div.html5audio div#no-ogg').show(); | |
} else { | |
$("div.html5audio div#no-ogg *").remove(); | |
} | |
embedFlash(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To do: one more level -- flash detection -- for the saddest of sad browsers