How to view video:
Update: If you want to be able to embed a video based on the link you get from the facebook api, you could do something like:
<object width="640" height="385">
<param name="movie" value="http://www.youtube.com/v/vX07j9SDFcc?autoplay=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/vX07j9SDFcc?autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed>
</object>
Just replace the youtube link.
If you want it to autoplay, REMEMBER TO INCLUDE THE ?autoplay=1
.
How to share video:
Here are two ways to do this:
METHOD 1: Open a Popup with the URL format:
http://www.facebook.com/sharer.php?u=[Youtube Link]
Sample code to implement this would be:
...onclick=function() {
window.open('http://www.facebook.com/sharer.php?u=[Youtube Link]');
}
The popup that will open will look like:
METHOD 2: Use Javascript API:
This can look more professional because you can display your message as an overlay iframe.
var share = {
method: 'stream.share',
u: '[Youtube Link]'
};
FB.ui(share, function(response) { console.log(response); });
Here's the documentation I based my code from:
http://developers.facebook.com/docs/reference/javascript/FB.ui
RESULT:
Either way, after the user clicks share, it should appear in the news feed: