我以前使用stream.publish
方法来完成此操作,在该方法中,我为.swf指定了源文件以及其他参数来显示媒体,但现在不赞成使用这种方法。如何使用Graph API来完成此操作?特别是Facebook PHP SDK。
使用php-sdk,您可以像这样发布它们:
$facebook->api('/me/feed', 'post', array(
'type'=>'video',
'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
'picture'=> 'http://fbrell.com/f8.jpg',
'name'=> 'Facebook Dialogs',
'caption'=> 'Reference',
'description'=> 'Using Dialogs to interact with users.',
);
您应该可以将link
属性添加到混合中,但目前facebook的api中似乎存在一个错误,导致包含link
的帖子无法嵌入swf
。通过这种方式,它将被嵌入,但结果帖子中的名称将指向swf
文件,这是不好的。与js sdk
中FB.ui发布的链接相同的值不会表现出这种行为。
一种解决方法是创建具有适当opengraph元标记的链接,并将其发布为type => 'link'
。
html文件(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调用以共享它
$this->facebook->api('/me/feed', 'post', array(
'type' => 'link',
'link' => 'http://.../', // put the html file's location here
));