这与a previous question类似,但现在我希望在从网页发布操作时包含YouTube视频,而不是在移动设备上发布供稿对话框。
下面的代码基于official facebook tutorial。我添加了基于another facebook documentation page的视频元标记。我已对该应用进行了身份验证,并在点击“发布”按钮时收到了成功提示框。但是,当我转到https://www.facebook.com/[MY USERNAME] /活动/ [我的操作ID]时,帖子会显示标题,网址和说明,但我看不到视频缩略图...
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# [MY NAMESPACE]: http://ogp.me/ns/fb/[MY NAMESPACE]#">
<meta property="fb:app_id" content="[MY APP ID]" />
<meta property="og:type" content="[MY NAMESPACE]:[MY OBJECT]" />
<meta property="og:url" content="[MY LINK]" />
<meta property="og:title" content="Sample Object" />
<meta property="og:image" content="http://i4.ytimg.com/vi/k86xpd26M2g/hqdefault.jpg">
<meta proprety="og:video" content="http://www.youtube.com/v/=yO7B9ERbqdY" />
<meta property="og:video:secure_url" content="https://www.youtube.com/v/yO7B9ERbqdY" />
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="398">
<meta property="og:video:height" content="224">
<meta property="og:site_name" content="YouTube">
<meta property="og:description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis eros metus. Etiam vehicula, eros quis ultrices pulvinar, sapien orci malesuada sem, malesuada hendrerit lacus massa nec eros. Nullam eget volutpat nunc. Phasellus quis mattis massa. Sed dolor lacus, rhoncus ut imperdiet ut, euismod eu ipsum." />
<script type="text/javascript">
function postDialog()
{
FB.api(
'/me/[MY NAMESPACE]:[MY ACTION]',
'post',
{ dialog: '[MY OBJECT URL]' },
function(response) {
if (!response || response.error) {
alert("Error Type: " + response.error.type + "\n\nMessage: " + response.error.message);
} else {
alert('Cook was successful! Action ID: ' + response.id);
}
}
);
}
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '[MY APP ID]', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true,
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<form>
<input type="button" value="Post" onclick="postDialog()" />
</form>
</body>
</html>
问题:
1)我做错了什么?如何才能将视频显示在帖子中?
2)略有不相关的question:我的帖子只显示在我的个人资料页面上的“最近的活动”中,因此不显示说明文字,但我真的希望我的时间轴中的帖子作为单独的帖子。这与我有没有提交此行动以获得批准呢?
整个下午和晚上一直试图摔跤......非常感谢你提前!
答案 0 :(得分:0)
您的og:url
指向youtube,它应该指向元标记所在的同一页面