API graph message not playing
I have an application that posts YouTube videos to a user's Facebook wall. A Facebook post would be for this embedded video to be played from Facebook. This has stopped recently.
After some testing, it seems that when you do a graphics API post with the source being a YouTube video, then the link also needs youtube.com
a domain to be played in the Facebook context.
Repeat:
You can take a look at yourself by logging into Facebook and going here:
https://developers.facebook.com/tools/explorer
Then get an access token with permissions read_stream
and publish_stream
(advanced permissions tab).
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
It should appear on your Facebook wall and be playable.
Now do it again, but change the link to http://www.google.com . It doesn't play anymore.
Can anyone confirm that this is the expected behavior? I can't find anything in the Facebook docs. Perhaps I am just missing something?
source to share
Generalized workaround
I summarized the answer to this similar question: posting swf to facebook feed via facebook api . I created a page that takes two parameters and generates the required tags meta
. Facebook accepts the link, the user is redirected correctly, and you don't need a separate page for each video posted.
-
url
- final url -
id
- youtube or embedded video id
I have successfully made many inline posts where the link was not related to the video.
Sample message
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
$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...";
}
?>
conclusions
I was able to reproduce your problem successfully. I couldn't find a job.
This has been reported as a bug for Facebook, but is considered a low priority.
Bugs: Submitting a video for submission using a link attribute does not include the source https://developers.facebook.com/bugs/502967809730190?browse=search_5074a2e48fd360934230075
source to share
Usually, to share YouTube videos on Facebook pages, you only need posts, links, sources, image options. Even you can also skip the original image options if you like. That is, if you are using the Facebook C # SDK to share Facebook videos all you need is the following code
var fb = new Facebook.FacebookClient(yourPageAccessToken);
argList["message"] = message;
argList["link"] = "http://www.youtube.com/watch?v=" + specialOffer.YoutubeId;
argList["source"] = "http://www.youtube.com/v/" + specialOffer.YoutubeId;
argList["picture"] = "http://img.youtube.com/vi/" + specialOffer.YoutubeId + "/0.jpg";
fb.Post("feed", argList);
or
var fb = new Facebook.FacebookClient(yourPageAccessToken);
argList["message"] = message;
argList["link"] = "http://www.youtube.com/watch?v=" + specialOffer.YoutubeId;
fb.Post("feed", argList);
source to share