Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 1.11 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Fallback solution for HTML <audio> and legacy browsers
  2. <script type="text/javascript" charset="utf-8">
  3.        $(function() {
  4.             $("audio").removeAttr("controls").each(function(i, audioElement) {
  5.                 var audio = $(this);
  6.                 var that = this; //closure to keep reference to current audio tag
  7.                 $("#doc").append($('<button>'+audio.attr("title")+'</button>').click(function() {
  8.                     that.play();
  9.                 }));
  10.             });
  11.         });
  12.     </script>
  13.  
  14.     <!-- Sample Audio Clip -->
  15.     <audio controls preload="auto" autobuffer title="Sounds of Laughter">
  16.     <source src="assets/clips/1.mp3" />
  17.     <source src="assets/clips/1.ogg" />
  18.     </audio>
  19.        
  20. var audio = new Audio();
  21. audio.src = Modernizr.audio.ogg ? 'background.ogg' :
  22.             Modernizr.audio.mp3 ? 'background.mp3' :
  23.                                   'background.m4a';
  24. audio.play();
  25.        
  26. $("#music").jPlayer({
  27.     ready: function (event) {
  28.         $(this).jPlayer("setMedia", {
  29.             mp3:"music.mp3",
  30.             oga:"music.ogg"
  31.         });
  32.     },
  33.     swfPath: "js",
  34.     supplied: "mp3, oga"
  35. });