A
A
arm1362015-03-27 17:43:40
JavaScript
arm136, 2015-03-27 17:43:40

How to make autoplay in jplayer.min.js player?

You need to fix the site on wp, the site has the jplayer.min.js player installed, you need the player to be with auto launch, there is no time to figure it out, but you need to do it today, I hope there is some kind of "good Samaritan" who can help me;)

<div class="player">
        <div id="audio-opener" class="audio-opener"></div>
      </div>
      
      <div id="jquery_jplayer_1" class="jp-jplayer"></div>
      <div id="jp_container_1" class="jp-audio">
        <div class="jp-type-single">
          <div class="jp-gui jp-interface">
            <ul class="jp-controls">
              <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
              <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
              <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
              <li><a href="#" class="jp-prev" tabindex="1" onClick="prev_song()">prev</a></li>
              <li><a href="#" class="jp-next" tabindex="1" onClick="next_song()">next</a></li>
            </ul>

          </div>
        </div>
      </div>

$('#audio-opener, #logo').on('click', function()
  {
    $('#main-nav a').removeClass('active');
    $.fancybox.close();
    $('.block').hide();
    $('.sub-nav').hide();
    $('#video-nav').hide();
    $('.gallery-nav').hide();
    $('.sub-nav-small').removeClass('sub-nav-small');		
    $('#audio-nav').fadeIn('slow');
    $('#slogan').fadeIn('slow');
    
    return false;
  });
  
  $('#audio-nav a').on('click', function()
  {
    $('#audio-nav li').removeClass('active');
    $(this).parent().addClass('active');
    
    $('#jp-title').html($(this).find('span').html());
    $('#jquery_jplayer_1').jPlayer('setMedia', {mp3: $(this).attr('href')}).jPlayer('play');
    
    return false;
  });
  
  $("#jquery_jplayer_1").jPlayer({
    swfPath: '/bitrix/templates/html/js/',
    supplied: 'mp3',
    wmode: 'window',
    ready: function(event) {
      $('#jp-title').html($('#audio-nav .active a span').html());
      $(this).jPlayer('setMedia', {mp3: $('#audio-nav .active a').attr('href')}).jPlayer("play");
    },
    ended: function() {
      next_song();
    }
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-03-27
@arm136

In theory, it should have started automatically:
You have a red event, in the body of which there is an attempt to autorun.
Is this code called on document.ready?
Drop the whole js file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question