那麼,有沒有我可以使用一個API從我在Facebook網站播放視頻時的用戶共享鏈接
@Eli,
是的,有一個API可以從Facebook上的網站播放視頻,它被稱爲Open Graph Protocol。閱讀所有關於它的地方:http://ogp.me/其他文檔可在https://developers.facebook.com/docs/opengraph/
請在下面找到一些示例代碼,以便開始使用,盡情享受。
<!doctype html>
<!--[if lt IE 7]><html lang="en" class="no-js ie6"><![endif]-->
<!--[if IE 7]><html lang="en" class="no-js ie7"><![endif]-->
<!--[if IE 8]><html lang="en" class="no-js ie8"><![endif]-->
<!--[if IE 9]><html lang="en" class="no-js ie9"><![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en" class="no_js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title></title>
<meta property="og:title" content="Title goes here">
<meta property="og:type" content="company">
<meta property="og:url" content="http://yourdomainhere.com/">
<meta property="og:image" content="http://yourdomainhere.com/og_image_that_shows_on_facebook.jpg">
<meta property="og:site_name" content="Your Site Name">
<meta property="fb:app_id" content="APP_ID_NUMBER_IF_YOU_HAVE_ONE">
<meta property="fb:admins" content="ADMIN_ID_NUMBER_FOR_FACEBOOK_ANALYTICS">
<meta property="og:description" content="Your description.">
<meta property="og:determiner" content="the" />
<meta property="og:locale" content="en_US" />
<meta property="og:locale:alternate" content="es_ES" />
<meta property="og:video" content="http://example.com/bond/trailer.swf" /><!--VIDEO SRC URL-->
<meta property="og:video:secure_url" content="https://secure.example.com/movie.swf" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video:width" content="400" />
<meta property="og:video:height" content="300" />
</head>
<body>
<div id="fb-root"></div>
<script>
/*Facebook Connect JavaScript SDK http://developers.facebook.com/docs/reference/javascript/FB.init/*/
window.fbAsyncInit = function() {
'use strict';
FB.init({
appId : 'APP_ID_GOES_HERE', //App ID
channelURL : '//yourdomainhere.com/channel.php', //Channel File
status : true, //Check login status
cookie : true, //Enable cookies to allow the server to access the session
xfbml : true, //Parse XFBML
oauth : true, //Enable OAuth 2.0
login : true,
authResponse : true, //Object
frictionlessRequests : true
});
//Additional initialization code here
};
/*Load the Facebook Connect JavaScript SDK Asynchronously */
(function(d){
'use strict';
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
</body>
</html>
謝謝!!我爲什麼vimeo,metacafe,dailymotion和其他人不這樣做! – Lynob
@Eli他們可能希望將流量吸引到他們的網站,如果用戶在Facebook網站上觀看視頻,則不會發生這種情況。 – Teddy
你說得對 – Lynob