1
votes

I am trying to post a link to a page that includes a video using the jSDK FB.ui(method:'feed). I want the video to be playable within the feed so I include the source attr.

All works except the size of the video appears to be a default that is unfortunately wrong for my videos orientation.

However when I post a link to the page using the update box on facebook it works perfectly because it is fetching the height/width from the og meta tags on the page.

Is there any way to pass through the width and height of the source when making a post through FB.ui or FB.api

Thanks

1

1 Answers

3
votes

Ok, So this took me a while to figure out. Hopefully this will help someone else.

The feed method of the js-sdk does not give you the options to set the height and width of the source attr. To overcome this you need to use the stream.publish method and set the expanded_width and expanded_height properties of the media property of the attachement property.

Like this -

FB.ui({
   method: "stream.publish",
   user_message_prompt: "",
   message: "message",
   attachment: {
      name: "name",
      caption: "caption",
      href: "link",
      media:[{"type": "flash", 
      "swfsrc": "blah.swf", 
      "imgsrc": "img.jpg",
      "expanded_width": "380", 
      "expanded_height": "430"}]
   }
});

Or if you want to pull the details from the OG tags then you can use the stream.share method to post a link which will then use the og tags from the link to work out what to display.

Hope that helps someone else!