我不确定这是否真的有意义......
对不起,但我不知道该怎么说。问题在于我有一个播放数组功能。功能是$("#myVid").bind("ended", function() {
$("#MyT").fadeIn(250);
function playArray(ele, array) {
index++;
if (index >= array.length) {
index = i;
}
ele.src = array[index];
ele.load();
ele.play();
}
playArray(document.getElementById("myVid"), videos);
基本上,当正在播放的视频结束时,它会播放数组中的下一个视频。这个想法是您可以使用<li>
标签的应用程序播放阵列中的任何视频。工作正常。
$(window).load(function(){
var index = 0;
var videos = ['images/Answer1b.m4v', 'images/Answer2b.m4v', 'images/Answer3b.m4v', 'images/Answer4b.m4v', 'images/Answer5b.m4v', 'images/Answer6b.m4v'];
$("#MyT").fadeOut();
$("li, .thumbs").bind("touchstart click", function() {
$("#bigPic").removeClass("move");
$("#MyT").fadeIn(0);
});
$('li', '.thumbs').on('touchend click', function() {
index = $(this).index();
var myVideo = document.getElementById('myVid');
myVideo.src = videos[index];
myVideo.load();
myVideo.play();
$("#myVid").bind("loadeddata", function() {
$("#bigPic").addClass("move");
$("#MyT").fadeOut(750);
});
$("#myVid").bind("playing", function() {
("#bigPic").removeClass("move");
$("#MyT").fadeOut(750);
});
$("#myVid").bind("ended", function() {
$("#bigPic").removeClass("move");
$("#MyT").fadeIn(250);
function playArray(ele, array) {
index++;
if (index >= array.length) {
index = 1;
}
ele.src = array[index];
ele.load();
ele.play();
}
playArray(document.getElementById("myVid"), videos);
});
});
video.on("timeupdate", function() {
var currentPos = myVid.currentTime;
var maxduration = myVid.duration;
var perc = 100 * currentPos / maxduration;
$(".timeBar").css("width",perc+"%");
});
var updatebar = function(x) {
var progress = $(".progress");
var maxduration = myVid.duration;
var percentage = 100 * position / progress.width();
if(percentage > 100) {
percentage = 100;}
if(percentage < 0) {
percentage = 0;}
$(".timeBar").css("width",percentage+"%");
myVid.currentTime = maxduration * percentage / 100;
};
});
我在两次点击(touchstart
和touchend
)中绑定了一些东西,因为如果不这样设置它们就会干扰......