开发者

What are the proper parameters for posting flash content using the Facebook Javascript SDK?

I am able to successfully post Flash content using FB.ui({method: 'stream_publish',....}).

However, since my app must also be able to post to Fan Pages, I cannot use FB.ui, and must use the Graph API via FB.api instead. No biggie, I'd rather have a custom form for posting anyway.

But it seems posting to a feed using FB.api('/FEED_ID/feed', ...) takes different parameters than the FB.ui method.

Documentation for the FB.api call and the Graph API is not particularly helpful. The Graph API docs mention a source parameter, which is supposed to be the url to the flash object. However, when I set source to be the flash object url, I get the following:


(#100) flash objects must have the 'swfsrc' and 'imgsrc' attributes.


OK, fine, but where do they go? The attachment parameter, which worked fine for FB.Connect and FB.ui, seems to be completely ignored.

Here's my code:

        body = {
                    name: "Name",
                    link: "http://mysite.com/link_to_my_content",
                    caption: "This is the caption",
                    message: "Test Message",
                    source: 'http://mysite.com/static/flash.swf',
                    image: 'http://mysite.com/static/images/facebook_thumb.png',
                    actions: action_links,
                    description: "The fascinating, compelling description"
                }

                FB.api('/me/feed', 'post', body, function(response){
                    if (!response 开发者_JAVA技巧|| response.error){
                        console.log("FB.api error occurred");
                        if (response.error){
                            console.log("Error message: " + response.error.message);
                        }
                    }
                    else {
                        console.log("Post successful: " + response);
                    }
                });

When posting to a Fan Page I also include the access_token parameter (and changing the url obviously) which seems to work fine. I just can't figure out how to get the flash content to publish. Where do the swfsrc and imgsrc attributes go? It's probably something that will seem obvious but I've tried everything I can think of. Google isn't helpful as it seems most people are just using stream_publish, and a bunch of old FB.Connect stuff.


Just found out that you have to supply picture when posting a source swf, or else you receive the imgsrc/swfsrc error message. See http://bugs.developers.facebook.net/show_bug.cgi?id=10672#c17

Go Facebook.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜