facebook unity sdk /user/feed embed youtube with link - facebook

I am using Facebook unity sdk 7.0.2
I am trying to share a link to my canvas game with a mediasource to my youtube video channel.
When I set mediaSource to http://www.youtube.com/e/xxxxxxx&autoplay=1 the link gets shared, and the picture appears, but there is no play button and no video, so when I click the link I am forwarded to my canvas.
var publishData =
new Dictionary<string, string>() { { "link", link },
{ "picture", pictureLink },
{ "name", linkName },
{ "caption", linkCaption },
{ "description", linkDescription },
{ "source", mediaSource },
{ "ref", feedref },
};
FB.API("/me/feed", HttpMethod.POST, FacebookFeedLog, publishData);
I tried to create an html with og:type set to video and upload it to my server, then set the mediasource to the new html file, in that case I just get a blank picture and a link to my canvas.
<meta property="fb:app_id" content="xxxxx" />
<meta property="og:type" content="video" />
<meta property="og:url" content="xxxx" />
<meta property="og:title" content="Watch video" />
<meta property="og:description" content="I am playing games, why not try it." />
<meta property="og:image" content="http://i2.ytimg.com/vi/xxxx/hqdefault.jpg" />
<meta property="og:video" content="http://www.youtube.com/e/xxxxautoplay=1" />
<meta property="og:video:width" content="398" />
<meta property="og:video:height" content="224" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
Is there a way to share a link to canvas application with an embedded youtube video?
Thanks for advance.

Almost there, try removing media source, and setting the link parameter to your OG object you hosted on your server.

Related

facebook share specific dynamic content according to page

I have a websites displaying cars. if user clicks on each car, it will direct to each car info page. I want to share each car content(image,title,description,url).
For ex.if user clicks on car with id 1,share dialog will display content for that car id 1, and if user clicks on car with id 2,share will display content for car id 2. I have googled for solution but have not found it. Below is my code.
<head>
<meta property="og:url" content="<?php echo 'http://motorcarmyanmar.com';?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Buy,Sell,Rent,Or Lease Cars Or Car Accessories In Myanmar" />
<meta property="og:description" content="Car Sales,Car Rentals,Car Accessories Sales" />
<meta property="og:image" content="http://motorcarmyanmar.com/pictures/car1.png" />
<meta property="og:image:alt" content="car picture"/>
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="400" />
<meta property="fb:app_id" content="1538657022815637" />
</head>
In the beginning of body.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '1538657022815637',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.8'
});
FB.AppEvents.logPageView();
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=1538657022815637";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
In the car info page.
<script>
document.getElementById('shareBtn').onclick = function() {
var title,description,image;
title=$('#title_fb').val();
description=$('#description_fb').val();
image=$('#image_fb').val();
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': window.location.href,
'og:title': title,
'og:description': description + ' Lakhs',
'og:image': image,
'og:image:width':'500',
'og:image:height':'400'
}
})
},
function (response) {
// Action after response
});
}
</script>
With the codes i have given, the dynamic share works. But i want the share image to be bigger not a thumbnail. I read that if share reaches 50 counts,og tags can not be edited. So is there another way to share or is this way right. I saw other website pages sharing dynamic content without creating objects.
Follow Facebookes best practices about pictures sizes: https://developers.facebook.com/docs/sharing/best-practices/#images
Also, you should use a separate URL with a separate og:url tag for each share and just method: 'share' without other parameters. That share_open_graph method is just a workaround.
For example:
<meta property="og:url" content="<?php echo 'http://motorcarmyanmar.com/?id=' . $_GET['id'];?>" />
Of course you need to check if the parameter even exists, but it´s just an example.
The url is
http://www.motorcarmyanmar.com/pages/car_details/ca36?ca36=Details&Details=ca36
<head>
<?php
$title_header="";
$description_header="";
$features_header="";
$image_header="";
if(isset($_GET['Details']))
{
$car_id=$_GET['Details'];
$car_details= //get from database width $car_id;
$title_header=$car_details['header'];
$description_header=$car_details['description'];
$image_header=$car_details['image'];
}
?>
<!-- You can use Open Graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
<meta property="og:url" content="<?php echo 'http://motorcarmyanmar.com' . $_SERVER['REQUEST_URI'];?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?php echo (!empty($title_header)?$title_header:'Some Buy,Sell,Rent');?>" />
<meta property="og:description" content="<?php echo (!empty($description_header)?$description_header:'Car Sales,Car Rentals,Car Accessories Sales');?>" />
<meta property="og:image" content="<?php echo (!empty($image_header)?$image_header:'http://motorcarmyanmar.com/images/icons/car1.jpg');?>" />
<meta property="og:image:alt" content="car picture"/>
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="400" />
<meta property="fb:app_id" content="1538657022815637" />
</head>
this is what i did. With this code, some pages show right share content(title,description,image),some pages show default homepage share content. But only url is right for each page. Is the code in right direction?

How to add the author name when sharing on Facebook

I'm just trying to add the name of the author in the share box dialog in FB
I've added the following meta and og property:
<meta name="author" content="foutight.com">
<meta property="og:type" content="article"/>
<meta property="og:article:author" content="foutight.com"/>
But no success. Any suggestions. Thanks.
That comes from the <meta name='author' content='...'/> section. It looks like it's appearing on http://foutight.com/posts/photo/242 - maybe you've just got a cached page?
Run it through oglint.com, and try and re-scrape it.
Try the author whitout the "og".
<meta property="og:type" content="article"/>
<meta property="article:author" content="foutight.com"/>
<meta name="author" content="foutight.com">
<meta property="article:author" content="https://www.facebook.com/author_profile" />
article:author may contain an array of Facebook profile URLs or IDs of the authors for this article.
https://developers.facebook.com/docs/reference/opengraph/object-type/article/
Open function.php and add code :
function author_chauit() {
if ( is_singular('post') ) {
echo '<meta name="author" content="'.get_the_author().'">';
} else {
echo '<meta name="author" content="'.get_bloginfo( 'name' ).'">';
}
}
add_action( 'wp_head', 'author_chauit' );
notes : add in end functioncode

FB Local Payment error: "Can't parse open graph object. Property price doesn't exist for item"

I am try set up payment for the FB application for with the static-priced products;
On the Javascript side, I do:
function callOrderUp()
{
alert("GO!1");
FB.ui({
method : 'pay',
action: 'purchaseitem',
display: 'popup',
product : "https://www.manyfbgames.com/ninetofive/products/product1.html",
quantity : 1
},
function(response)
{
alert(JSON.stringify(response, null, 4));
}
);
}
The contents of product files are:
<!DOCTYPE html>
<html>
<head prefix=
"og: http://ogp.me/ns#
fb: http://ogp.me/ns/fb#
product: http://ogp.me/ns/product#">
<meta property="og:type" content="og:product" />
<meta property="og:title" content="Test 1" />
<meta property="og:plural_title" content="Test 2" />
<meta property="og:image" content="http://manyfbgames.com/ninetofive/products/product1.png" />
<meta property="og:description" content="Friend Smash Coins to purchase upgrades and items!" />
<meta property="og:url" content="https://www.manyfbgames.com/ninetofive/products/product1.html" />
<meta property="product:price:amount" content="2"/>
<meta property="product:price:currency" content="USD"/>
</head>
</html>
For some reason, I always get this error:
An error occurred. Please try again later.
API Error Code: 1383051
API Error Description: Can't parse open graph object. Property price doesn't exist for item 218298155037105
But I am sure that price to the product data is correct, and I can see that price is set! What else might be causing this?
You have an og:url tag pointing to a different URL - this redirects Facebook to that URL, which is not in your control and may not have the correct tags for your product
the og:url tag should point to the canonical URL for your object, probably the same URL you're rendering the tags from in most cases

Open graph actions suddenly not working properly

I had an action which used to work fine until today morning but now its not behaving the way it should.
Facebook is not catching variables that i send after "index.jsp?". Because of which though the actions are published it show it shows null for the puzzle id and timing.
Below are codes i tried both gave me same issues.
FB.api('/me/mpuzzleapp:solve?mpuzzle='+encodeURIComponent('{mycompleteurl}/index.jsp?mid='+mid+'&timing='+timing+'&access_token='+accessToken),'post',
function(response) {
if (!response || response.error) {
//alert(response.error.message);
}else{
alert("Action posted successfully.")
}
});
FB.api(
'/me/mpuzzleapp:solve',
'post',
{
mpuzzle: '{mycompleteurl}/index.jsp?mid='+mid+'&timing='+timing+'&access_token='+accessToken
},
function(response) {
if (!response || response.error) {
alert(response.error.message);
}else{
alert("Action posted successfully.")
}
}
);
Previously this used to work fine, Now it is just not able to catch parameter with my url. the link that was posted in my wall is this.
https://apps.facebook.com/mpuzzleapp/index.jsp?fb_action_ids=10151927328076515&fb_action_types=mpuzzleapp%3Asolve&fb_source=timeline_og&action_object_map=%7B%2210151927328076515%22%3A401787199906324%7D&action_type_map=%7B%2210151927328076515%22%3A%22mpuzzleapp%3Asolve%22%7D&action_ref_map=%5B%5D
it is missing mid and timing parameter.
I had to change my og:url tag and it worked perfect :
Old :
<meta property="fb:app_id" content="278272228942900" />
<meta property="og:type" content="mpuzzleapp:mpuzzle" />
<meta property="og:url" content="https://apps.facebook.com/mpuzzleapp/index.jsp" />
<meta property="og:title" content="MPuzzle 3" />
<meta property="mpuzzleapp:to" content="friends" />
<meta property="mpuzzleapp:timing" content="00:00:45" />
<meta property="og:image" content="https://www.vishweshshetty.com/Facebook/puzzlemsg/65/images/icon.jpg" />
New :
<meta property="fb:app_id" content="278272228942900" />
<meta property="og:type" content="mpuzzleapp:mpuzzle" />
<meta property="og:url" content="https://apps.facebook.com/mpuzzleapp/index.jsp?mid=3&timing=00:00:45"&tolist=friends&pathpic=https://www.vishweshshetty.com/Facebook/puzzlemsg/65/images/icon.jpg" />
<meta property="og:title" content="MPuzzle 3" />
<meta property="mpuzzleapp:to" content="friends" />
<meta property="mpuzzleapp:timing" content="00:00:45" />
<meta property="og:image" content="https://www.vishweshshetty.com/Facebook/puzzlemsg/65/images/icon.jpg" />

Post swf with parameters to facebook via application

I have a facebook application where the user choose 4 of his friends and then it creates a video (swf) with the pictures of your friends in it (loaded via xml). So I need to share this video on the user timeline. Everything works fine but the video is not embedded in the post on his timeline, there is only a post with the link to the page in it.
The weird thing is, if I post the url directly on my timeline, the video is embedded, but not if the same link is posted via the application.
here is my code called by the share button in js :
function postToFeed() {
var obj = {
method: 'feed',
link: 'https://mysite.com/flash/share-page.php?id=22',
picture: 'https://mysite.com/images/video-preview.jpg',
name: 'Name',
caption: 'Caption',
description: 'Description'
};
function callback(response) {
//some code here
}
FB.ui(obj, callback);
}
and the code in my share-page.php
<?php
$id_inscription = $_GET['id'];
$video_url = 'https://mysite.com/flash/share-page.php?id=22';
$video_preview_image = 'https://mysite.com/images/video-preview.jpg';
?>
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-language" content="en">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta property="og:video" content="<?php echo $video_url; ?>"/>
<!-- Open grah tags for Facebook -->
<meta property="og:title" content="Test video player" />
<meta property="og:description" content="A video player interface experiment." />
<meta property="og:type" content="video" />
<meta property="og:url" content="<?php echo $video_url; ?>"/>
<meta property="og:image" content="<?php echo $video_preview_image; ?>"/>
<meta property="og:site_name" content="Site name"/>
<!-- Video specific open graph tags -->
<meta property="og:video" content="<?php echo $video_url; ?>" />
<meta property="og:video:secure_url" content="<?php echo $video_url; ?>" /> <!-- Required for people on Facebook who have secure browsing enabled! -->
<meta property="og:video:width" content="325" />
<meta property="og:video:height" content="180" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
<script src="js/swfobject.js"></script>
<script>
var flashvars = {
xmlUrl:"xml/data-<?php echo $id_inscription; ?>.xml",
policyFileUrl:"http://profile.ak.fbcdn.net/crossdomain.xml"
};
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "",
wmode: "opaque"
//wmode: "direct" // can cause issues with FP settings & webcam
};
var attributes = {
id:"content"
};
swfobject.embedSWF(
"app.swf",
"altContent", "480", "270", "10.0.0",
"expressInstall.swf",
flashvars, params, attributes);
</script>
</head>
<body>
<div id="altContent">
<p>Get Adobe Flash player</p>
</div>
</body>
</html>
Found it, in the javascript you have to add
source: 'https://mysite.com/flash/app.swf'
DOesnt work for me .
Also facebook says ,It is NOT supposed to work By Design .
https://developers.facebook.com/bugs/589975484398226?browse=external_tasks_search_results_526fc388b99e18881434478
Please share here your code snippet if you could make it work . I have the meta tags taking care for the secure video Url as well .