admin管理员组文章数量:1429841
I'm using Fancybox to play a youtube video. Works as expected. Video pops up and plays great. However, I would like to use both AUTOPLAY and Start Time when my video is clicked.
Here is the URL I'm trying.
;amp;autoplay=1&t=0m47s
Autoplay works fine, but the start time is ignored.
Any suggestions?
Thanks!
I'm using Fancybox to play a youtube video. Works as expected. Video pops up and plays great. However, I would like to use both AUTOPLAY and Start Time when my video is clicked.
Here is the URL I'm trying.
http://www.youtube./watch?v=BwaKZ4r5fQM&autoplay=1&t=0m47s
Autoplay works fine, but the start time is ignored.
Any suggestions?
Thanks!
Share Improve this question edited Mar 12, 2015 at 22:30 Rick Freeman asked Mar 12, 2015 at 20:33 Rick FreemanRick Freeman 411 gold badge1 silver badge5 bronze badges1 Answer
Reset to default 2The easiest way to do is using fancybox media helpers so
1). Load the fancybox media helper js file :
<script type="text/javascript" src="{your correct path}/helpers/jquery.fancybox-media.js"></script>
2). Only set your youtube URL without any parameter like :
<a class="fancybox" href="http://www.youtube./watch?v=BwaKZ4r5fQM">Start YouTube in fancybox at 47 secs</a>
3). Enable the media helper in your fancybox custom initialization script and pass the youtube parameters using this format :
jQuery(document).ready(function ($) {
$(".fancybox").fancybox({
helpers: {
media: true
},
youtube: {
autoplay: 1, // enable autoplay
start: 47 // set start time in seconds (embed)
}
}); // fancybox
}); // ready
NOTE : the media helper will convert the video URL in its embed format like :
http://www.youtube./embed/BwaKZ4r5fQM
... where the parameter t={mm}m{ss}s
is not longer valid.
With youtube embedded player you can select the start time using the start
parameter followed by the number in seconds of the wanted starting time (as we did in the fancybox initialization script)
本文标签: javascriptFancyboxplay a youtube video with start time and autoplayStack Overflow
版权声明:本文标题:javascript - Fancybox, play a youtube video with start time and autoplay - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745476697a2659995.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论