fancybox
fancybox copied to clipboard
Prevent Video from Auto Playing Next video
Is there a way to auto play a video, but not roll into the next one in the set and auto start it?
Hi,
Sorry, there is currently no option for that.
I was actually able to get it to stop advancing to the next video but still autoplay the video itself by using the following (set autoplay in the video element, but turn 'autostart' false):
$.fancybox.defaults.video = {
tpl:
'<video class="fancybox-video" autoplay controls controlsList="nodownload" poster="{{poster}}">' +
'<source src="{{src}}" type="{{format}}" />' +
'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' +
"</video>",
format: "", // custom video format
autoStart: false
}
You can also remove :
player.on("ended", function () {
instance.next();
});
from https://github.com/fancyapps/fancybox/blob/c4fd90370f8c93336d6e36a5c6120bcabcf8675c/dist/jquery.fancybox.js#L3710
(vimeo example here, the youtube code is just above)
I was actually able to get it to stop advancing to the next video but still autoplay the video itself by using the following (set autoplay in the video element, but turn 'autostart' false):
$.fancybox.defaults.video = { tpl: '<video class="fancybox-video" autoplay controls controlsList="nodownload" poster="{{poster}}">' + '<source src="{{src}}" type="{{format}}" />' + 'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' + "</video>", format: "", // custom video format autoStart: false }
Great! it works as i expected! THANK YOU ^--^