HTML5 Video with Fancybox

橙三吉。 提交于 2019-12-06 01:02:38
JFK

You can autoplay the video as soon as it is opened in fancybox. The problem with the inline video is that if you close it then it will pause and the next time you open it in fancybox, the video will be open in the same place/track it was when closed ... and it won't "auto-resume" (the action is autoplay on start).

Anyway, this option should do the trick:

'onComplete': function(){
$("#myVideo").find('video').attr('autoplay','autoplay');
}

#myVideo is the ID of the DIV, which contains the video tag.

Since you are using the inline method, it would worth to have a look at one existing bug and its workaround here.

Eventually, you may prefer to use the API option 'content' instead, to avoid the inline type issues:

'content': '<video autoplay="autoplay" preload="none" poster="path/image.jpg" width="640" height="360" controls="controls"><source autoplay="autoplay" src="path/video.ogg" type="video/ogg">your browser does not support the HTML 5 video tag</video>'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!