I am using the below array and
$feeddata = array(
'type'=>'flash',
'method'=>'stream.publish',
'display'=>'iframe',
'link'=> 'https://developers.facebook.com/docs/reference/dialogs/',
'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
'picture'=> 'http://fbrell.com/f8.jpg',
'name'=> 'Facebook Dialogs',
'caption'=> 'Reference Documentation',
'description'=> 'Using Dialogs to interact with users.');
and passing it to facebook->api($userid.'/feed', 'POST', $feeddata ); But in the feed i can see only the image and when i click in the image it takes me to the link, how can i see swf in the feed (ideally on clicking on the picture it should toggle to swf)
The type
should be "video" instead of "flash". Here's a parameter array that produced a playable video in my tests:
array(
'type'=>'video',
'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
'picture'=> 'http://fbrell.com/f8.jpg',
'name'=> 'Facebook Dialogs',
'caption'=> 'Reference Documentation',
'description'=> 'Using Dialogs to interact with users.',
);
Note that there's no link
attribute, that's because as it seems to me, the facebook API has a bug at this moment where if you provide a link then it won't embed your video.
The bug theory reinforced by that the JS SDK does indeed accept a link and produce a playable video, you could migrate to this method for publishing if its feasable, with parameters like this:
FB.ui({
method:'feed',
type: 'video',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
source: 'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
description: 'Using Dialogs to interact with users.'
});
Workaround
The embedding seem to be working fine if you post a link that has the proper opengraph meta tags for video embedding, here's an example:
the link to be shared (video brought to you by youtube)
<html>
<head>
<title>Fly, you fools!</title>
<meta property="og:title" content="Fly, you fools!" />
<meta property="og:type" content="website"/>
<meta property="og:description" content="Content for Description" />
<meta property="og:image" content="http://i2.ytimg.com/vi/meOCdyS7ORE/mqdefault.jpg" />
<meta property="og:site_name" content="Content for caption"/>
<meta property="og:video" content="http://www.youtube.com/v/meOCdyS7ORE?version=3&autohide=1">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="360">
</head>
<body>
<script>
window.location = 'http://disney.com'; // redirecting users who's clicking on the link, wont affect crawlers since its in js.
</script>
</body>
</html>
php sdk call to share it
$this->facebook->api('/me/feed', 'post', array(
'type' => 'link',
'link' => 'http://.../', // put the html file's location here
));
write one more met tag :
<meta property="og:video:secure_url" content="https://...game url.">
"
try to put "https:// " game url ,i.e game swf url with ssl, because fb takes only ssl url to play videos or swf file for game.
Hope this will be useful.
来源:https://stackoverflow.com/questions/11649932/posting-a-swf-in-facebook-feed-through-facebook-api