2011-03-10 5 views
0

내 wordpress 사이트에서 jsplayer HTML5 플레이어를 사용할뿐만 아니라 다음 게시물에로드하고 비디오가 끝나면 이전 컨텐츠를 대체 할 사용자 정의 스크립트를 사용합니다.jQuery를 통해 ajax를 사용하여 wordpress에서 html5 비디오 재생 목록

$(document).ready(function(){ 
     $(".video-js").livequery('ended', function(){ 
      var sStr = "<?php echo get_permalink(get_adjacent_post(true,'',true)); ?>"; 
      var adj_numb = "<?php 
          $adj = get_adjacent_post(true,'',true); 
          $numb = $adj->ID; 
          echo $numb 
          ?>"; 
      var cur_numb = "<?php echo $post->ID; ?>"; 
      $.post(sStr, function(data) { 
       var content = $(data).find('#post-' + adj_numb); 
       $("#post-" + cur_numb).html(content); 
       var vid = VideoJS.setup("vid"); 
       vid.play(); 
      }); 
     }); 
    }); 

이 동영상은 2 개의 동영상에 유용합니다. 다음 비디오에로드되어 재생되고, 그 다음에 재생되지만, 3 번째 비디오 재생 후에는 그냥 멈 춥니 다. 이 말은 내가 모든 변수를 "재설정"하고 스크립트 시작 부분에서 다시 시작해야한다는 것을 의미하며, $ (document) .ready (function())로 인해이 작업을 수행하지 않는다는 것을 의미합니다. 이 시점.

루프에 대한 표준 방법은 다시 스크립트를 통해 있는가, 그 실행 한 번?

후 모든 변수를 재 세트 아니면 내가 잘못 모든 문제에 접근하고있다?

감사합니다!

렌더링 된 JS :

$(document).ready(function(){ 
     $(".video-js").livequery('ended', function(){ 
      var sStr = "http://www.theloniousfilms.com/zachmath/volkswagon/"; 
      var adj_numb = "94"; 
      var cur_numb = "96"; 
      $.post(sStr, function(data) { 
       var content = $(data).find('#post-' + adj_numb); 
       $("#post-" + cur_numb).html(content); 
       var vid = VideoJS.setup("vid"); 
       vid.play(); 
      }); 
     }); 
    }); 

HTML :

<div class="post-96 post type-post status-publish format-standard hentry category-zachmath" id="post-96"> 
      <h2 id="director">Director Name</h2> 

      <h2 id="post_title">Post-Name 
       <span id="post_name"> 

       "Hot Tub" 
       </span> 
       <span id="home"><a href="http://www.homelink.com/">HOME</a></span> 

       <div class="entry"> 

        <div class="video-js-box"> 
     <!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody --><br /> 
     <video id="vid" class="video-js" width="640" height="360" preload autoplay poster="http://www.site.com/wp-content/uploads/2011/03/poster.jpg"><br /> 
      <source src="http://d29zgp48wvs9kv.cloudfront.net/orkin.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /><br /> 

      <source src="http://d29zgp48wvs9kv.cloudfront.net/orkin.ogv" type='video/ogg; codecs="theora, vorbis"' /><br /> 
      <!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. --><br /> 
      <object class="vjs-flash-fallback" width="640" height="360" type="application/x-shockwave-flash"<br /> 
      data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"><param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" /><param name="allowfullscreen" value="true" /><param name="flashvars" value='config={"playlist":["http://www.theloniousfilms.com/wp-content/uploads/2011/03/poster.jpg", {"url": "http://d29zgp48wvs9kv.cloudfront.net/orkin.m4v","autoPlay":true,"autoBuffering":true}]}' /><!-- Image Fallback. Typically the same as the poster image. --><br /> 
      </object><br /> 
     </video> 
     </div> 

답변

0

내가 재생 한 번 배열의 다음 항목에 가고, 나는 배열에 모든 게시물의 URL은 다음 그들 각각을 통해 반복 뽑아 다른 방법으로가는 종료 끝마친.

관련 문제