I need your help.
Is it possible to use fancybox as the movie player without youtube? just reading the file on server and displaying it?
thats the script for fancy youtube:
<script>
$(document).ready(function(){
$("a.video").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'title' : this.title,
'overlayOpacity' : '.6',
'overlayColor' : '#333',
'transitionIn' : 'none',
'transitionOut' : 'none',
'centerOnScroll' : false,
'showCloseButton' : true,
'hideOnOverlayClick': false,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode': 'transparent',
'allowfullscreen': 'true'
}
});
return false;
});
});
</script>
- html:
‘< a class=”video iframe” href=”http://www.youtube.com/watch?=Psk2Pq03rv0&fs=1″>Arbitrary text < / a>’
can i change it not to use YT but default player?
As a matter of fact, you will always need a player. Fancybox cannot be used as a player “per se”, however you may use another player other than the YouTube default player like JWPlayer for instance.
JwPlayer supports to play YouTube videos since v4.x so the following options are valid:
or
so you could easily embed youtube videos on your webpages using jwplayer instead of the default youtube player like:
Now, using the same embedding technique mentioned above, you may tweak your fancybox script to use jwplayer to play the youtube video specified in the
hrefof your anchor so:Using the html:
(notice that I removed the class
iframe… it’s not needed)Use the edited script:
Notice that I am using the API option ‘
content‘ instead of ‘href‘ to embed the video into the fancybox, however I am still using thehrefto convert the URL to its simplified version.Finally, I am assuming that you are using fancybox v1.3.x because the options you are using so the script will work with that version only.