Monday, April 11, 2011

Popcorn.js - LinkedIn Plugin

Make a LinkedIn plugin... sounds easy, no? I figured if I made a Facebook plugin, this will be a walk in the part. Well Facebook developers can sleep easier knowing that I have greater respect for them.

What's are some of the most terrible things you can do to a user? Have meaningless error messages coupled with poor/scattered documentation. Most of the time spent making this plugin was spent on searching their website and asking myself "WHY?".

My error, as I found out after days of searching, was cause by an application id variable that was never set. This is why, if you look at my html code
( https://github.com/DanVentura/popcorn-js/commit/7443a2960ca27cbd09bd283c850a0cf27049acbe ) I have to set the app_id variable before calling popcorn.linkedin.js. Simple, right? Try figuring that out when you only have THIS to go on:

U.match(M) is null

}function f(U){return U.match(M)[1]

"function f(U)"... Gee, they just come right out and say it don't they? LOL

Fortunately, for those who wish to use my plugin, I've included a helpful error message with a link to the page where you can get an api_key. The one included in the html code from my demo on matrix is valid for all of the matrix domain, so go nuts.

Anyways, here's how you can put a LinkedIn share button with your popcorn video:

var p = Popcorn('#video')
.linkedin({
type : 'share',
url : "http://www.google.ca",
counter : "right",
target : 'sharediv'
} );

1 comment: