2017-09-04 13 views
0

내 사이트에서 jplayer를 내 사이트에서 음악을 재생하는 mediaelement 플레이어 (wordpress)에 바인딩하려고합니다.Jplayer가 mediaelement에 연결/바인딩되었습니다.

나는 이미 일을했지만 뭔가를 놓치고 있습니다. functions.php 파일에서 나는

//Enqueue scripts 
function register_scripts() { 
     wp_enqueue_script('jplayer',get_template_directory_uri().'/jplayer/jplayer.min.js',null,'1',false); 

} 
add_action('wp_enqueue_scripts','register_scripts'); 

다음 내가
<div id="WM" class="jp-jplayer"></div> 
<div id="jp_container_1" class="jp-audio" role="application" aria-label="media player"> 
    <div class="jp-type-single"> 
     <div class="jp-gui jp-interface"> 
      <div class="jp-controls-holder" style="width:100px"> 
       <div class="jp-controls" style="float:left;"> 
        <button class="jp-play" role="button" tabindex="0" style="padding:0;">p</button> 
        <button class="jp-stop" role="button" tabindex="0" style="padding:0;">s</button> 
       </div> 
       <div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div> 
      </div> 
     </div> 
    </div 

그때 내가 바닥 글

<script> 
jQuery(document).ready(function() { 
    jQuery("#WM").jPlayer({ 
     ready: function(){ 
      jQuery(this).jPlayer("setMedia", { 
       mp3: "https://example.com/mymp.mp3" 
      }); 
     }, 
    }); 

}); 
</script> 

에 추가하고 지금 여기에 내가 고민하고 일부 헤더에 추가했다. jplayer에는 오디오 워터 마크가있는 파일이 포함되어 있기 때문에 Jplayer는 내 사이트에서 mediaelement 플레이어와 함께 연주해야합니다. 따라서 미디어 요소를 통해 재생되는 음악을 재생할 수 있습니다 (내 테마에서 지원). 그래서 바닥 글에도 추가 코드는 다음과 같습니다

<script> 
      // click on play button 

      jQuery('.home, .page-id-53, .page-id-29 ,.tax-download_tag, .tax-download_category, .search-results,.tax-download_tempo,.tax-download-artist').find('.mejs-button.mejs-playpause-button').on('click', function() { 

jQuery(window).load(function() { 
         setTimeout(function(){ 

         jQuery("#WM").jPlayer("volume", 1); 
         jQuery("#WM").jPlayer("play", 0); 
         }, 1000); 
        }); 

        jQuery(document).on('click', '.mejs-play > button', function() { 

</script> 

어쩌면 누군가 경우 어떤 이유로 jplayer, 나는 재생 버튼 (MediaElement에)를 클릭 해당 파일 내가 무엇을 알고 내가 뭔가를 놓친 거지 생각하지만, 그나마이 재생되지 않는위한 재생 버튼을 클릭 할 때 재생되도록하기 위해해야 ​​할 일을 알고 있지만 일시 중지하고 다시 재생하면 처음부터 재생해야합니다.

답변

0

이이

<script> 
      // click on play button 

      jQuery('.home, .page-id-53, .page-id-29 ,.tax-download_tag, .tax-download_category, .search-results,.tax-download_tempo,.tax-download-artist').find('.mejs-button.mejs-playpause-button').on('click', function() { 

가 지금은 jplayer 재생 버튼을 실행하는 무언가를 추가해야하는 코드의 시작이다 말할 수 있습니다 감사