fancybox icon indicating copy to clipboard operation
fancybox copied to clipboard

Prevent Video from Auto Playing Next video

Open agentKnipe opened this issue 6 years ago • 4 comments

Is there a way to auto play a video, but not roll into the next one in the set and auto start it?

agentKnipe avatar Sep 03 '19 20:09 agentKnipe

Hi,

Sorry, there is currently no option for that.

fancyapps avatar Sep 04 '19 05:09 fancyapps

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 
	}


joephuz avatar Sep 20 '19 01:09 joephuz

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)

bichonnages avatar Nov 26 '20 16:11 bichonnages

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 ^--^

jaeeewon avatar Feb 15 '23 17:02 jaeeewon