Advertisement
Guest User

Javascript JPlayer init

a guest
Jun 6th, 2012
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. var arrayObj = new Array();
  2. <?php
  3. openDB();
  4. mysql_query('SET NAMES utf8; ');
  5. $SQL = "SELECT * FROM audio WHERE url2 <>'' ORDER BY id desc;";
  6. $result = mysql_query($SQL) or die (mysql_error());
  7. $i=0;
  8. while($row = mysql_fetch_assoc($result))
  9. {
  10. ?>
  11. arrayObj[<?php echo $i; ?>] = new Array(<?php echo "'".$row['url']."','".$row['url2']."'"; ?>);
  12. <?php
  13. $i++;
  14. }
  15. ?>
  16.  
  17.  
  18.  
  19.  
  20. $(document).ready(function(){
  21.  
  22.  
  23. $(".podcastNew").append('<img src="../images/nuevoPod.png" class="nuevoPod" alt="Nuevo!!" />');
  24.  
  25.  
  26.  
  27. for( var i=0; i< arrayObj.length; i++)
  28. {
  29. //alert(arrayObj[i][0]);
  30. $("#jquery_jplayer_"+i).jPlayer({
  31. ready: function () {
  32. $(this).jPlayer("setMedia", {
  33. m4a: "http://www.itzelcarranza.com/Sounds/Radio/"+arrayObj[i][0],
  34. //m4a: "http://www.jplayer.org/audio/m4a/Miaow-08-Stirring-of-a-fool.m4a",
  35. //oga: "http://www.jplayer.org/audio/ogg/Miaow-08-Stirring-of-a-fool.ogg"
  36. oga: "http://www.itzelcarranza.com/Sounds/Radio/"+arrayObj[i][1]
  37. });
  38. },
  39. play: function() { // To avoid both jPlayers playing together.
  40. $(this).jPlayer("pauseOthers");
  41. },
  42. repeat: function(event) { // Override the default jPlayer repeat event handler
  43. if(event.jPlayer.options.loop) {
  44. $(this).unbind(".jPlayerRepeat").unbind(".jPlayerNext");
  45. $(this).bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() {
  46. $(this).jPlayer("play");
  47. });
  48. } else {
  49. $(this).unbind(".jPlayerRepeat").unbind(".jPlayerNext");
  50. $(this).bind($.jPlayer.event.ended + ".jPlayer.jPlayerNext", function() {
  51. $("#jquery_jplayer_+i").jPlayer("play", 0);
  52. });
  53. }
  54. },
  55. swfPath: "js",
  56. supplied: "m4a, oga",
  57. wmode: "window"
  58. });
  59. }
  60.  
  61.  
  62.  
  63.  
  64. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement