type
应该是“视频”而不是“闪光灯” 。这是一个在我的测试中生成可播放视频的参数数组:
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.',
);
请注意,没有link
属性,那是因为在我看来,facebook API 目前有一个错误,如果您提供链接,那么它将不会嵌入您的视频。
JS SDK确实接受链接并生成可播放的视频强化了错误理论,如果可行,您可以迁移到此方法进行发布,参数如下:
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.'
});
解决方法
如果您发布具有适当的用于视频嵌入的 opengraph 元标记的链接,嵌入似乎工作正常,这是一个示例:
要分享的链接(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
));