视频API图表不可播放 [英] Graph API post of video is not playable
问题描述
我有一个应用程序,将YouTube上的音乐视频发布到Facebook用户的墙上。 Facebook上的这篇文章将会播放来自Facebook的嵌入式视频。最近它停止了发生。
I have an application that posts music videos from YouTube to a Facebook user's wall. The post on Facebook would have this embed video be playable from Facebook. Recently it stopped happening.
经过一些测试,似乎当人们将图形API发布到源视频为YouTube视频时,该链接也需要 youtube。 com
在域中可以播放。
After some testing, it seems that when one makes the graph API post with the source being a YouTube video, then the link also needs youtube.com
in the domain for it to be playable within a Facebook context.
要重复:
您可以通过登录Facebook并访问此处来查找自己:
You can take a look for yourself by logging into Facebook and going here:
https://developers.facebook.com/tools/explorer
然后用 read_stream
和 publish_stream
权限(扩展权限选项卡)。
Then get an access token with read_stream
and publish_stream
permissions (extended permissions tab).
从 GET
到 POST
,并将端点设置为/ me / feed,其中包含以下字段:
Switch from GET
to POST
and set the endpoint to /me/feed with the following fields:
message = message
description = description
name = name
caption = caption
link = http://www.youtube.com/watch?v=r1dfEf1qOt4
source = http://www.youtube.com/e/r1dfEf1qOt4
picture = http://img.youtube.com/vi/r1dfEf1qOt4/0.jpg
应该显示在您的Facebook墙上,并可播放。
It should show up on your Facebook wall and be playable.
现在再做一次,但将链接更改为 http://www.google.com 。
它不再可以播放。
Now do it again, but change the link to http://www.google.com. It is no longer playable.
任何人都可以确认这是否是预期的行为?我在Facebook文档中找不到任何东西。也许我只是想念一些东西?
Can anyone confirm if this is expected behavior? I can't find anything in the Facebook docs. Perhaps I am just missing something?
推荐答案
广义解决方法
a href =https://stackoverflow.com/a/11651634/1085891>我将答案归纳为这个类似的问题:通过facebook api 在Facebook feed中发布swf。我创建了一个页面,它需要两个参数,并生成必需的元
标签。 Facebook接受链接,用户正确重定向,并且您不需要为每个已发布的视频单独的页面。
Generalized Workaround
I generalized the answer to this similar question: posting a swf in facebook feed through facebook api. I created a page that takes two parameters and generates the necessary meta
tags. Facebook accepts the link, the user is correctly redirected, and you don't need a separate page for each posted video.
-
url
- 最终的URL -
id
- YouTube或嵌入式视频的ID
url
- the final URLid
- the id of the youtube or embedded video
我成功制作了许多嵌入式帖子,其中的链接与视频没有关联。
I successfully made numerous embedded posts in which the link was not associated with the video.
message = Post message
description = Post description if needed.
name = Post name
caption = Post caption
link = http://vbcopper.com/jsuar/so/fbembedvideo.php?url=stackoverflow.com&id=QGAJokcwBXI
source = http://www.youtube.com/e/QGAJokcwBXI
picture = http://img.youtube.com/vi/QGAJokcwBXI/0.jpg
PHP
PHP
<?php
$id = $_GET["id"];
$url = $_GET["url"];
if ( isset($url) ) {
echo <<< EOT
<html>
<head>
<title>$url</title>
<meta property="og:title" content="Page Title" />
<meta property="og:type" content="website"/>
<meta property="og:description" content="Content for Description" />
<meta property="og:image" content="http://i2.ytimg.com/vi/$id/mqdefault.jpg" />
<meta property="og:site_name" content="Content for caption"/>
<meta property="og:video" content="http://www.youtube.com/v/$id?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">
<META http-equiv="refresh" content="1;URL=http://$url">
</head>
<body>
</body>
</html>
EOT;
} else {
echo "Nothing here...";
}
?>
结果
我能够成功复制你的问题。
Findings
I was able to successfully replicate your issue. I could find no work around.
这是一个错误提交给Facebook但被认为是低优先级。
This has been submitted as a bug to Facebook but deemed low priority.
错误:使用链接属性发布视频没有嵌入源
https://developers.facebook.com/bugs/502967809730190?browse=search_5074a2e48fd360934230075
这篇关于视频API图表不可播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!