所以我在我的WordPress站点上使用jsplayer HTML5播放器,以及一些自定义脚本在下一篇文章中加载,并在视频完成后替换旧内容:多次循环遍历jQuery .post函数
$(document).ready(function(){
$(".video-js").bind('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();
});
});
});
这对于一个视频来说效果很好。它加载下一个视频并播放它,但在第二个视频播放后,它就停止。我想这意味着我必须对所有变量进行“重置”,然后从脚本开始重新开始,并且由于$(document).ready(function(),因为它已经全部加载。这一点
是否有通过这个脚本环路的标准方式再次,它运行一次后重新设置所有的变量
感谢
编辑:?!渲染JS:
$(document).ready(function(){
$(".video-js").live('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">Zach Math</h2>
<h2 id="post_title">Orkin -
<span id="post_name">
"Hot Tub"
</span>
<span id="home"><a href="http://www.theloniousfilms.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.theloniousfilms.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>
你也可以提供相应的HTML。 – 2011-03-10 02:22:35