Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

JPlayer

By: paglaw on Aug 7th, 2011  |  syntax: HTML 5  |  size: 1.30 KB  |  views: 224  |  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. <html>
  2. <head>
  3.   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  4.   <script type="text/javascript" src="/Scripts/jquery.jplayer.min.js"></script>
  5.    <script type="text/javascript">
  6.  
  7.    $(document).ready(function () {
  8.     $("#jquery_jplayer").jPlayer({
  9.         ready: function () {
  10.             $(this).jPlayer("setMedia", {
  11.                 mp3: "/Music/MUSICFILE.mp3"
  12.             }).jPlayer("play");
  13.             var click = document.ontouchstart === undefined ? 'click' : 'touchstart';
  14.             var kickoff = function () {
  15.                 $("#jquery_jplayer").jPlayer("play");
  16.                 document.documentElement.removeEventListener(click, kickoff, true);
  17.             };
  18.             document.documentElement.addEventListener(click, kickoff, true);
  19.         },
  20.         ended: function () {
  21.             $(this).jPlayer("play");
  22.         },
  23.         swfPath: "/Scripts"
  24.     });
  25. });
  26.  
  27.   </script>
  28.   <style type="text/css">
  29.     #jquery_jplayer {
  30.       width:0px;
  31.       height:0px;
  32.     }
  33.   </style>
  34. </head>
  35. <body>
  36.   <div id="jquery_jplayer"></div>
  37.  
  38.   <a href="javascript:void(0)" onclick="$('#jquery_jplayer').jPlayer('play')">on</a>
  39.   <a href="javascript:void(0)" onclick="$('#jquery_jplayer').jPlayer('pause')">off</a>
  40. </body>
  41. </html>