点击触发视频不会一直播放?
triggering video on click doesn't not play all the time?
这是我的情况:
我有很多视频,每个视频都在不同的灯箱中播放。
当打开灯箱时,我通过点击覆盖的播放按钮来触发视频。使用以下内容可以很好地启动视频:
$('a.trigger-video-play').parent().click(function () {
$(this).children("video")[0].play()
$('a.trigger-video-play').fadeOut('slow')
$(this).children('#video-play').attr('controls', true);
$($('a.trigger-video-play').get(0)).show();
$('.lightbox-background').addClass('pause');
$(this).children("video").addClass('topause')
});
触发视频播放的行开始:
$(this).children("video")[0].play()
在灯箱外部单击时,我正在使用此代码来:
$('.lightbox-background').click(function () {
$(this).fadeOut('slow');
$('#halo-one.lightbox-outbox').fadeOut('slow');
$('.lightbox-outbox').fadeOut('slow');
$('a.trigger-video-play').fadeIn('slow')
$("video").each(function () {
this.pause(this.load())
})
$("#video-play").each(function () {
$(this).attr('controls', false);
})
jQuery.each($("iframe.web"), function () {
$(this).attr({
src: $(this).attr("src")
});
});
});
1/ 停止视频并从零开始播放(这样当用户回来时,视频将从零开始播放):
$("video").each(function () {
this.pause(this.load())
})
我遇到的问题是有时,当用户触发视频播放时,视频没有播放。用户必须触摸/拖动一点控制栏才能播放视频!这是非常随机的。
我想知道这是否与使用负载的第二个函数冲突?
有人有什么建议吗?
会超级棒的
感谢大家
问题出在你的方法上
this.pause(this.load())
尝试使用:
$("video").each(function () {
this.pause();
this.currentTime = 0; //make currenttime 0 to start from beginning
})
这是我的情况:
我有很多视频,每个视频都在不同的灯箱中播放。
当打开灯箱时,我通过点击覆盖的播放按钮来触发视频。使用以下内容可以很好地启动视频:
$('a.trigger-video-play').parent().click(function () {
$(this).children("video")[0].play()
$('a.trigger-video-play').fadeOut('slow')
$(this).children('#video-play').attr('controls', true);
$($('a.trigger-video-play').get(0)).show();
$('.lightbox-background').addClass('pause');
$(this).children("video").addClass('topause')
});
触发视频播放的行开始:
$(this).children("video")[0].play()
在灯箱外部单击时,我正在使用此代码来:
$('.lightbox-background').click(function () {
$(this).fadeOut('slow');
$('#halo-one.lightbox-outbox').fadeOut('slow');
$('.lightbox-outbox').fadeOut('slow');
$('a.trigger-video-play').fadeIn('slow')
$("video").each(function () {
this.pause(this.load())
})
$("#video-play").each(function () {
$(this).attr('controls', false);
})
jQuery.each($("iframe.web"), function () {
$(this).attr({
src: $(this).attr("src")
});
});
});
1/ 停止视频并从零开始播放(这样当用户回来时,视频将从零开始播放):
$("video").each(function () {
this.pause(this.load())
})
我遇到的问题是有时,当用户触发视频播放时,视频没有播放。用户必须触摸/拖动一点控制栏才能播放视频!这是非常随机的。
我想知道这是否与使用负载的第二个函数冲突?
有人有什么建议吗?
会超级棒的
感谢大家
问题出在你的方法上
this.pause(this.load())
尝试使用:
$("video").each(function () {
this.pause();
this.currentTime = 0; //make currenttime 0 to start from beginning
})