javascript - Fancybox returning " The requested content cannot be loaded. Please try again later." -
using fancybox play youtube videos in modal box.
my problem keep getting "the requested content cannot loaded. please try again later."
the modal box popping know script running, might problem api call... here call:
<script type="text/javascript"> $(document).ready(function() { /* basic - uses default settings */ $("a.fancybox").fancybox({ 'hideoncontentclick': true }); /* non-obtrustive method youtube videos*/ $("a[rel=fancyvideo]").fancybox({ overlayshow: true, framewidth:640, frameheight:360, }); }); </script>
do have <a>
s both class="fancybox"
, rel="fancyvideo"
? if you'll binding fancybox elements twice , fancybox might not that. try taking out one:
$("a.fancybox").fancybox({ 'hideoncontentclick': true });
and see happens second 1 in place.
update: strange. demo (http://chadly.net/demos/video-lightbox.html) producing different html page, demo builds <object data=...>
yours builds <object><embed src="youtube-url">
thing. you're saying:
type: 'swf'
in fancybox binding, that's <object><embed>...</embed></object>
stuff comes from. however, href
points @ plain old youtube video viewing html page , href
ends src
attribute <embed>
. url embedding youtube video isn't same video's html page , that's source of problem.
try replacing href
looks this:
http://www.youtube.com/watch?v=qmvvgsfdmjq
with 1 this:
http://www.youtube.com/embed/qmvvgsfdmjq
the first plain html page youtube, second embeddable swf.
update 2: example you're working fancybox 1.0.0 you're using 1.3.4, 1.0.0 has special checks youtube aren't present in later versions:
//... } else if (url.match(/youtube\.com\/watch/i)) { //...
that's 1.0.0 , code after else if
rewrites html page url (e.g. http://www.youtube.com/watch?v=qmvvgsfdmjq
) older embeddable swf url (e.g. http://www.youtube.com/v/qmvvgsfdmjq
). version problem explains why demo producing different html your's.
so, have version problems on top of else.
Comments
Post a Comment