Guest User

Untitled

a guest
Feb 4th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $(document).ready(function(){
  3.  
  4.     $("#jquery_jplayer_1").jPlayer({
  5.             ready: function (event) {
  6.            
  7.                 var data = $.ajax({
  8.                   url: "../php/radiostream.php?id="+ potok,
  9.                   async: false
  10.                  }).responseText;
  11.  
  12.                     var string = data.split('|');
  13.                    
  14.                            
  15.                             $('.strem_title').html(string[1]);
  16.                             document.getElementById('img_stream_radio').src = ''+ string[2] +'';
  17.                             document.getElementById('url_stream_radio').href = ''+ string[3] +'';
  18.                    
  19.                 player_ready = true;
  20.                 $(this).jPlayer('setMedia', { mp3: string[0] });
  21.             },
  22.             pause: function() {
  23.                 $(this).jPlayer('clearMedia');
  24.                
  25.             },
  26.             error: function(event) {
  27.                 if (player_ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {
  28.                         $(this).jPlayer('setMedia', { mp3: string[0] }).jPlayer('play');
  29.                    
  30.                 } else {
  31.                    
  32.                 }
  33.             },
  34.         swfPath: "../jsplayer",
  35.         supplied: "mp3",
  36.         solution:"html, flash",
  37.         preload: "none",
  38.         wmode: "window",
  39.         keyEnabled: true
  40.     });
  41.    
  42.     $('.play-radio').bind('click', function() {
  43.             var key = $(this).attr('data-stream');
  44.                
  45.                 var potok = $(this).attr('data-potok');
  46.                 var data = $.ajax({
  47.                   url: "../php/radiostream.php?id="+ potok,
  48.                   async: false
  49.                  }).responseText;
  50.  
  51.             var string = data.split('|');
  52.            
  53.                     document.getElementById('img_stream_radio').src = ''+ string[2] +'';
  54.                     $('.strem_title').html(string[1]);
  55.            
  56.             //$('.carousel img').removeClass('active');
  57.             //$(this).addClass('active');
  58.  
  59.             $('#jquery_jplayer_1').jPlayer('clearMedia');
  60.  
  61.             $('#jquery_jplayer_1').jPlayer('setMedia', { mp3: string[0] }).jPlayer('play');
  62.            
  63.  
  64.             return false;
  65.         });
  66.        
  67.         var mPlayer = $("#jquery_jplayer_1"),
  68.             options = {
  69.                 volumechange: function(event) {
  70.                         if(event.jPlayer.options.muted) {
  71.                             myControl.volume.slider("value", 0);
  72.                         } else {
  73.                             myControl.volume.slider("value", event.jPlayer.options.volume);
  74.                         }
  75.                     },
  76.                     cssSelectorAncestor: "#jp_container_1"
  77.                 }  
  78.         myControl = {
  79.                     volume: $(options.cssSelectorAncestor + " .jp-volume-slider")
  80.                 };
  81.                 $('.jp-gui ul li').hover(
  82.                 function() { $(this).addClass('u-state-hover'); },
  83.                 function() { $(this).removeClass('u-state-hover'); }
  84.             );
  85.                 myControl.volume.slider({
  86.                 animate: "fast",
  87.                 max: 1,
  88.                 range: "min",
  89.                 step: 0.01,
  90.                 value : $.jPlayer.prototype.options.volume,
  91.                 superslide: function(event, ui) {
  92.                     mPlayer.jPlayer("option", "muted", false);
  93.                     mPlayer.jPlayer("option", "volume", ui.value);
  94.                 }
  95.             });
  96.    
  97.     $('#player a.jp-play').bind('click', function() {
  98.             $('#player .song').html(player_loading);
  99.            
  100.  
  101.             return false;
  102.         });
  103. });
Advertisement
Add Comment
Please, Sign In to add comment