Using JW Player in FBML to Bypass YouTube Video Ads

In a previous post, I showed you how to embed YouTube videos in FBML using or . That solution is easy, but pulling in YouTube videos this way often means your video ends with a series of Google ads – not good, when you’re working on a corporate page or app, and those ads might easily be for a competitor.

There’s no way to embed the normal YouTube player without those Google ads, but there is a reasonably painless solution, using a fabulous Flash video player called JW Player from LongTail Video. They have a free non-commercial version, but I’m guessing if you client cares enough to be torqued about the ads, they can probably spring the $89. Okay okay, $89 seems steep for a video player – but it’s a far cry less than it would cost to hire a Flash programmer to create something from scratch, and from personal experience, JW Player is worth every single penny.

So all we’re doing is using the standard code to call up JW Player, and then sticking all of the additional paramters onto the swfsrc.

We can extend this to include any of the (extensive) options that JW Player supports – and it’s an impressive list. They even provide a handy wizard that lets you pick all of your options and will generate the HTML/JS code for you. Of course, the default code they generate will not work in FBML, since it uses non-FBJS JavaScript and code that Facebook won’t grok in FBML, but if you click on the little link above the code that lets you generate code for MySpace and blogs, you can see an HTML-only version of all of the options. That HTML still won’t work out of the box in FBML, but it will make it easier to see how to include your additional options.

So, for example, if you wanted to embed a version of JW Player that includes a playlist in the player itself, your FBML would look something like this:

Note that the size is larger, to accomodate the increased height for the playlist. Also note that waitforclick being set to false doesn’t actually work on Static FBML app tabs, as part of Facebook’s policy.

JW Player also supports playing mp3 files without any video at all, so this can be an elegant solution for lots of situations. In fact, although this article was written specifically to help you bypass YouTube ads, the same code applies if you just decide that you like JW Player’s options and would prefer to use it instead of the stock YouTube/Facebook video players.

About the author

snipe

I’m a tech geek/dev/infosec-nerd/scuba diver/blacksmith/sword-fighter/crime fighter/ENTP/warcrafter/activist. I run Grokability, Inc, and run several open source projects, including Snipe-IT Asset Management. Tweet at me @snipeyhead or read more…

Glad it helped! I have to do this a lot, although usually with custom flash players, since our clients wouldn’t want competitor ads showing on their video (totally understood), so seemed good to jot down while it’s fresh in my head.

Haglund_victor

Hi Snip!
Just wanted to give you kudos and love all the way from Sweden. Great page, and I am using most of the FB codes presented here on my fanpages. Keep up the good work, very much aprichiated!

Best regards Victor

Christopher Scott Knell

After a few hours of Googlin’, I found this page of yours and it did the trick.
Thanks so much.
Here it is in action:

Is JW Player against youtube terms of service? I can’t find a definitive answer anywhere. My player has the youtube logo which links back to youtube, so I think that’s cool, but it also blocks the regular youtube ads and has my own (and longtails) preroll ads showing, is that ok?

Search

About Me

I’m a tech geek/dev/infosec-nerd/scuba diver/blacksmith/sword-fighter/crime fighter/ENTP/warcrafter/activist. I run Grokability, Inc, and run several open source projects, including Snipe-IT Asset Management. Tweet at me @snipeyhead or read more…