I’d like to embed a remote video file into a facebook post using the graph API. My .mp4 file lives on the rackspace cloudfiles cdn.
I’m currently doing the following:
curl -F 'access_token=...' \
-F 'message=Link to my .mp4 video' \
-F 'source=http://c334110.r11.cf1.rackcdn.com/test.mp4' \
-F 'picture=http://someimage.jpg' \
https://graph.facebook.com/me/feed
It makes a post that has a blank spot where an embedded video would normally be, but no video.
I’ve seen plenty of examples that do this with a youtube video. Will this ever work, or do I need to serve up a page that has the appropriate open graph meta data with a link to the mp4 file?
So it turns out I was making this a bit harder than I needed to. If I just want to share a link and have it embed a video, the graph api is not necessary. In fact, getting the video to embed on facebook is pretty simple.
Here are the steps I took:
Acquire a .swf flash player, and ensure that it is served over https.
Use the following meta tag:
<meta property="og:video" content="https://path/to/player.swf?url=location/of/vid.mp4">Note: I’m passing the flashvar "url". This may vary depending on your flash player.
Have a link on your site that goes to: "http://m.facebook.com/sharer.php?u="
Make sure the query string parameter "u" is URL encoded.
I also found the Facebook debugger to be very helpful in getting the meta tags right.