FancyPlayer Revisited – jQuery Fancybox and Flowplayer Complete Integration
Posted in Tutorials by JohnI have recently decided to revisit the FancyPlayer code and after receiving feedback on the blog from our visitors, here’s the new more comprehensive integration of FancyBox and FlowPlayer.
People were asking for full Fancybox support, basically the gallery function using the “rel” attribute and the posibility to use mixed video/images galleries, so I have now added that. I have decided to stick to the “don’t touch the original code” of the two plugins rule, so that made it a bit more difficult, yet not impossible. Now you can add several videos and images as a gallery by using the “rel” attribute for the links and Flowplayer customization is possible as well (the look of control buttons, deactivate fullscreen etc).
Here’s the code inside fancyplayer.js which allows you to customize Flowplayer look and behaviour (the settings are pretty much self-explanatory):
controls: { backgroundColor: 'transparent', progressColor: 'transparent', bufferColor: 'transparent', all:false, scrubber:true, volume:true, mute:true, play:true, height:30, autoHide: 'always' },
Just modify it accordingly to your needs.
The new code available for download on the demo page (just check the page for link setup and the fancyplayer.js file).
An important change based also on user feedback is the use of Fancybox’ native function for opening an image by setting the “href” attribute to the image that the link is on. There was a small issue with the previous code since no actual image was loaded in the Fancybox and it would show the “null” text just before loading the video player. I have decided to change the code accordingly so it is now using the “name” attribute to tell the Javascript what to do next depending on if it’s an image or a video file it has to load.
If the “name” attribute of the link is “image”, it just loads the image from the path set in the “href” attribute as Fancybox would normally do (you can see in the demo that the second link is to an image of the Cadbury Gorrilla, while the other two are videos), if it’s a link to a flash video file it will first load the image file from “href” (I am linking to the actual image the link is on in the demo, which is recommended since that image is already loaded in the visitor’s browser), thus getting rid of the “null” issue, and then calls Flowplayer and loads the video.
I have also made a small adjustment to the dimensions of the container based on feedback from conrad (thanks). 20px added both to width and height of the outer FancyBox div so it would adjust accordingly and show the true video size. The distortion was caused by the extra pixels of the white frame I had not taken into consideration.
One last addition based on steve z’s comment. If you want to trigger FancyPlayer when the page is loaded just add this <script> inside your page’s <head> or right inside fancyplayer.js (skip the $(document).ready in this case):
$(document).ready(function() {
$("#mylink").focus();
$("#mylink").click();
});
Just make sure to add the id “#mylink” to the image/video link you want to open first.
As usual, I recommend that, if you want more information about customizing the 2 plugins, you should visit their respective pages here for Fancybox: http://fancybox.net/ and here for Flowplayer: http://flowplayer.org/ . Looking forward to your comments as well as links to pages where you have implemented this.
Related Entries
About the author
John, is the founder of Burconsult, a web consulting and development studio based in the south of Spain.
I define myself as a jack-of-all-web-trades, and have been addicted to the whole web business for ten years now. Thought I would start sharing some of the experience with the rest of the community on this blog. Your comments are appreciated and I will try to answer any doubts you might have.
Thank you for reading my tutorials and keep up the good work!
-
http://bloggeriz.blogspot.com/ security
-
http://www.martinagency.com/ Chris
-
http://wmerrick@mac.com will merrick
-
http://www.martinagency.com/ Chris
-
Jaspero
-
Philip
-
Jaspero
-
Philip
-
Rene
-
rene
-
http://www.creatiff.com.ua Sergeu
-
James
-
http://www.borninfall.com/en/ Tetyana
-
Asif
-
http://www.asevatu.com Fernando
-
Ben Sparrow
-
http://www.clippingimages.com Shamima Sultana
-
http://ikalianpark.com IkalianPark
-
http://ikalianpark.com IkalianPark
-
http://ikalianpark.com IkalianPark
-
http://www.richgates.com Rich Gates
-
Mike
-
http://www.asevatu.com Fernando
-
http://coolkurt.com kurt
-
Risk
-
MattM
-
MattM
-
Farrah
-
http://its-me.us/ Scott
-
http://pamblizzarddotcom PD Blizzard
-
serm
-
Jonathan
-
Jonathan
-
http://blog.nextmola.com Henning Mølbæk
-
Greg
-
maTT
-
DukeS
-
http://www.iranianlivetv.com Nick
-
badee
-
Ken
-
http://www.faceajan.com Face Ajan
-
Timo
-
http://www.kagestudio.com kj
-
http://www.kagestudio.com kj
-
JR
-
http://twycf.com/wordpress/ shinn
-
http://twycf.com/wordpress/ shinn
-
http://balajee.co.cc/ Balajee
-
http://balajee.co.cc/ Balajee
-
Kevin
-
Peter Schmidler
-
Peter Schmidler
-
http://www.kidslikecoloringpages.com/category/spongebob/ Coloring Pages
-
http://www.i-capshop.com wholesale new era hats
-
http://www.kidslikecoloringpages.com/category/handy-manny/ Coloring Pages
-
Kew
-
Steve
-
http://www.rhubarbmedia.ca Mark
-
http://www.hats-trade.com red bull energy hats
-
michi-es
-
Roman
-
http://n/a Parker Bennett
-
Nikhil
-
millzee
-
http://www.china-blockmachine.com/ Brick machine
-
http://www.offerjewelry.com cheap chanel bracelet
-
http://www.down-jackets-sale.com/ Moncler Man jackets
-
http://edc-info.org Ed Johnstone
-
http://www.agico.com.cn oil press
-
http://edc-info.org Ed
-
Christopher
-
tugboat
-
Amanda
-
http://www.tristan-jahier.fr Tristan Jahier
-
http://www.tristan-jahier.fr Tristan Jahier
-
http://www.tristan-jahier.fr Tristan Jahier
-
Emre
-
Greg McGee
-
http://thuraya.com gk sezhian
-
http://www.y8girlsgames.com Y8
-
http://www.estudiosmedia.com.ar Mauro chius
-
Ansh
Sponsors
Recent Comments
- Ansh on FancyPlayer Revisited – jQuery Fancybox and Flowplayer Complete Integration
- Published Articles on Inspiration: The Art Of Luke Lucas
- Fast Business Loan on Create a Glass Text effect in Photoshop
- Fast Business Funding on Inspiration: The Art Of Luke Lucas
- Fast Business Funding on Create a live-update list effect with jQuery
Recent Posts
- Inspiration: The Art Of Fredy Santiago
- Freebie: Complete Web UI Kit for your next design
- Inspiration: The Art Of Rob Shields
- Freebie: Aluminium UI Buttons
- Inspiration: The Art Of Maxime Archambault

