
Untitled
By: a guest on
Aug 8th, 2012 | syntax:
None | size: 1.11 KB | hits: 8 | expires: Never
Fallback solution for HTML <audio> and legacy browsers
<script type="text/javascript" charset="utf-8">
$(function() {
$("audio").removeAttr("controls").each(function(i, audioElement) {
var audio = $(this);
var that = this; //closure to keep reference to current audio tag
$("#doc").append($('<button>'+audio.attr("title")+'</button>').click(function() {
that.play();
}));
});
});
</script>
<!-- Sample Audio Clip -->
<audio controls preload="auto" autobuffer title="Sounds of Laughter">
<source src="assets/clips/1.mp3" />
<source src="assets/clips/1.ogg" />
</audio>
var audio = new Audio();
audio.src = Modernizr.audio.ogg ? 'background.ogg' :
Modernizr.audio.mp3 ? 'background.mp3' :
'background.m4a';
audio.play();
$("#music").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3:"music.mp3",
oga:"music.ogg"
});
},
swfPath: "js",
supplied: "mp3, oga"
});