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)