我的理解是,我只需要在被喜欢/分享的URL上放置正确的Open Graph
<meta>
标签。然而,我已经尝试了几组不同的<meta>
标签,但视频仍无法嵌入到状态更新和发布中。它确实嵌入了og:image
属性的图像,但点击图片只会将用户传递到og:url
。当我使用Facebook调试工具时,这是它显示的原始Open Graph文档信息:
Meta Tag: <meta property="fb:app_id" content="000000000000000" />
Meta Tag: <meta property="og:url" content="http://www.testdomain.com/path/to/shared/page" />
Meta Tag: <meta property="og:title" content="Example Page" />
Meta Tag: <meta property="og:description" content="Example Description" />
Meta Tag: <meta property="og:site_name" content="Example" />
Meta Tag: <meta property="og:image" content="http://content.example.com/images/example.png" />
Meta Tag: <meta property="og:type" content="video.other" />
Meta Tag: <meta property="og:video:width" content="400" />
Meta Tag: <meta property="og:video:height" content="300" />
Meta Tag: <meta property="og:video" content="http://static.example.com/flowplayer-3.2.15.swf?config=%7b%22clip%22%3a%22http%3a%2f%2fcontent.example.com%2fpath%2fto%2fvideo.mp4%3fv%3d0%22%7d" />
Meta Tag: <meta property="og:video:type" content="application/x-shockwave-flash" />
Meta Tag: <meta property="og:video" content="http://content.example.com/path/to/video.mp4?v=0" />
Meta Tag: <meta property="og:video:type" content="video/mp4" />
Meta Tag: <meta property="og:video" content="http://www.testdomain.com/path/to/shared/page" />
Meta Tag: <meta property="og:video:type" content="text/html" />
上述数值已被替换为虚拟数值,但它们都是有效的链接。
Facebook似乎正确解析了这个,因为它显示在分享类型 -> 视频下:
status: Video embedding on Facebook enabled
1: application/x-shockwave-flash
2: text/html
当我直接访问Flash播放器URL (
http://static.example.com/flowplayer-3.2.15.swf?config=%7b%22clip%22%3a%22http%3a%2f%2fcontent.example.com%2fpath%2fto%2fvideo.mp4%3fv%3d0%22%7d
) 时,视频可以正常播放(嵌入在Flash播放器中)。
我尝试/考虑过的事情:
跳过Flash播放器
最初,我甚至没有在og:video
列表中放置Flash播放器,而是首先尝试使用mp4文件。 Facebook没有捕捉到它,并将其视为普通链接分享。
白名单
曾经需要在允许嵌入式视频之前将应用程序/域名列入白名单。 现在不再需要。 我没有将我的域名列入白名单。
HTTPS
一些资料表明,正在使用的 flash 播放器需要在 HTTPS 上托管。我的研究表明,只有当用户在 HTTPS 上浏览 Facebook 时才适用这一点,在我测试时并没有这样做。我目前正在运行一些测试,使用 HTTPS 服务的 flash 播放器来查看是否有任何变化。
旧标签
为了好玩,我尝试添加 较旧的 Facebook
和 标记(例如 title , video_src ),以查看是否会拾取它们。它没有。
缓存刷新
我通过 Facebook 调试器中的 URL 传递了一个?fbrefresh = 1 ,以确保清除 URL 的缓存版本。这确实导致了最新的元信息被提取,但仍然没有嵌入。
iPad
Since I've got the video/mp4
fallback in my og:video
tags, I looked at my Facebook news feed in the iPad app. Excitingly, the thumbnail image had a little play button overlayed on it. However, touching the play button resulted in a redirect to the share URL instead of playing the video inline. Safari on the iPad had the same behavior (but with no play button overlay).
文档命名空间
我在我的标记中添加了适当的Open Graph/Facebook命名空间。
<html xmlns:og="http://ogp.me.ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# video: http://ogp.me/ns/video#">
但是似乎没有产生任何影响。我认为它们不是必需的。
我是否有所遗漏?我感觉到目前为止我找到的很多资源可能已经过时了,因为Facebook已经多次更改了他们的API,所以有可能我错过了新的要求。
如何在Facebook时间线内嵌入并播放视频?
看一下YouTube的og:
元标签,我能发现唯一的区别是:
- YouTube's
og:url
and og:video
are served from the same domain and subdomain (www.youtube.com
). Mine are served from the same domain, but different subdomains (media: content.example.com
, player: static.example.com
). Does the subdomain have to be the sam across all of the og:
meta information?
YouTube's share URL isn't a straight .swf
per se, but it is flash content:
rob@uvm:~$ curl "http://www.youtube.com/v/oHg5SJYRHA0?version=3&autohide=1" > yt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4242 100 4242 0 0 43522 0 --:--:-- --:--:-- --:--:-- 55815
rob@uvm:~$ file yt
yt: Macromedia Flash data (compressed), version 10
我刚刚意识到我的一个URL实际上在另一个域中。我有一种感觉,那就是罪魁祸首。我现在正在移动一些东西来尝试它。我已经更新了上面的元标记数据。感觉有点羞愧,因为没有提前观察到这一点。
swf
。 - Lixconfig
用于flowplayer。我会尝试一下。 - Rob Hruska