I am working my way through setting up a paired encoder for Facebook Live. Following https://developers.facebook.com/docs/videos/live-video/getting-started/#pairing and https://developers.facebook.com/docs/graph-api/reference/live-encoder/. I have been able to register the encoder and get a FBID, and broadcast_id. I am stuck at the "status:capture" point. Facebook send the {action:"capture"} response, but when the encoder responds with the video parameters, I get an error {message (#100) Invalid parameter, type OAuthException, code 100} I am currently testing using the Graph API Explorer, but I get the same error with my scripts. I am not sure what parameter is invalid...
Thanks!
Here is what I am sending (with a valid token):
status CAPTURE
broadcast_id **************
cap_streaming_protocols rtmp
cap_audio_codecs aac
cap_video_codecs h264
input_video_width 1920
input_video_height 1080
input_video_framerate 30000/1001
input_audio_samplerate 48000
input_audio_channels 2
Here my code snippet:
$.ajax({
method: 'POST',
url: "//graph.facebook.com/"+fbid+"?access_token="+fbToken,
data: {
'status':'CAPTURE',
'broadcast_id': broadcast_id,
'cap_streaming_protocols': 'rtmp',
'cap_audio_codecs':'aac',
'cap_video_codecs':'h264',
'input_video_width': '1920',
'input_video_height': '1080',
'input_video_framerate': '30000/1001',
'input_audio_samplerate': '48000',
'input_audio_channels': '2'
},
}).done(function(response){
console.log(response);
$('#link').html(response);
});
I just hit this today. As of this moment, cap_streaming_protocols=rtmps is the only value it accepts. If you need the rtmp url you can get that using the broadcast_id on the live_video edge. The rest looks like it should work.
Related
I have an interview assignment where I need to submit details and resume to the following website:
http://sr-recruit.herokuapp.com
I am using POSTMAN to submit that. When I tried to give a GET call to the link above I get the following output in the body as below:
{
"message": "POST to /resumes with 'name', 'email', 'about' (255 max) and 'file' (attachment) instead."
}
Can I know how to post my data with all the keys above together with my resume by uploading it in the postman. I was not able to view any form-data in the body to upload the file and when I try to use the POST method I get the following error.
{
"message": "These parameters are required: 'name', 'email', 'about' (255 max) and 'file' (attachment)"
}
Can anyone please guide me If I am doing the correct way or If I am doing it wrong and how to send my data to this web ? If the way I am trying to do is correct can I know how I can upload my resume into that "file" key ?
Make sure you're doing a POST and not a GET, and that it's to the /resumes endpoint, and that you also select a file:
Hitting URL #1 (https://graph.facebook.com/280518352029215) associated to this REAL url (http://www.sephora.com/rose-h-cream-P224527) in a browser CORRECTLY outputs this:
{
about: "What it is:A rich hand moisturizer.What it is formulated to do:Jurlique's Rose Hand Cream deeply hydrates the hands, restoring a soft, supple feeling.What it is formulated WITHOUT:- Parabens- Synthetic Fragrances- Synthetic Dyes- Petro-ChemicalsWhat",
category: "Product/service",
description: "What it is:A rich hand moisturizer.What it is formulated to do:Jurlique's Rose Hand Cream deeply hydrates the hands, restoring a soft, supple feeling.What it is formulated WITHOUT:- Parabens- Synthetic Fragrances- Synthetic Dyes- Petro-ChemicalsWhat",
is_published: true,
talking_about_count: 0,
were_here_count: 0,
id: "280518352029215",
name: "Sephora: Rose Hand Cream : hands-feet-bath-body",
link: "http://www.sephora.com/rose-h-cream-P224527",
likes: 1
}
URL #2 (https://graph.facebook.com/541777132555995) associated to (http://www.sephora.com/green-tea-oil-control-mask-P379853) has a completely different response even though open graph meta tags are identical to URL #1. This is the response:
error: {
message: "An access token is required to request this resource.",
type: "OAuthException",
code: 104
}
additionally, even using an access token I still get this response:
https://graph.facebook.com/541777132555995?access_token=158904350882249|753f74bda2299df3758d21708c7ba34c
error: {
message: "Unsupported get request.",
type: "GraphMethodException",
code: 100
}
I need URL #2 to have a response like URL #1... with or without an access token, I just need a response similar to URL #1. Both URL's are coming from the same website and app where their meta tags are programmatically generated, thus I don't see why FB could successfully consume URL #1, but not URL #2... please help!
Thanks
Well, I think we cannot help you without the real url of the object, so as to see what it is!
Have you try both url (the real ones) in facebook debugger: https://developers.facebook.com/tools/debug
to see the difference?
I'm using FBJS to post photo
FB.api('me/photos', 'post', {
message: 'some message',
url: 'some url'
}, function(response){
if (!response || response.error) {
/*some error alert*/
else {
/*some success*/
}
}
});
Almost, it works fine, but OCCASIONALLY, it shows error alert.
I see on Console, it says: Resource interpreted as Script but transferred with MIME type text/html
How to deal with it?
I've tried some solutions (such as Content-Type, script type...) but it still does not works in SOME times :(
Please help me.
I had that problem and in my case the reason was local - the "Disconnect" Chrome addon, that was blocking requests to facebook, I just forgot that I had it installed.
Have you tried
headers: [
{ "name":"Content-Type",
"value":"text/javascript; charset=UTF-8"}
]
If it is only occasional, maybe you're hitting an API call limit and it's returning an error? Check that the data is correct, even if it is getting an error. Use fiddler to get more clear diagnostic results.
I currently playing around with the Facebook JavaScript SDK and the Scores API ( https://developers.facebook.com/docs/score/ ). I wrote a small application to save (post) scores and now I want to delete scores. Posting (saving) them works fine.
My code looks like this:
var deleteHighScoreUrl = 'https://graph.facebook.com/'+facebook.user.id+'/scores?access_token='+facebook.application.id+'|'+facebook.application.secret;
jQuery.ajax(
{
type: 'DELETE',
async: false,
url: deleteHighScoreUrl,
success: function(data, textStatus, jqXHR)
{
console.log('Score deleted.');
}
});
The "facebook" variable is an object that holds my application data. For HTTP POST it works fine but for HTTP DELETE I get the response "NetworkError: 400 Bad Request" in Firebug (with Firefox 10). I saw that Firefox first sends an HTTP OPTIONS (to see if it is allowed to use HTTP DELETE) which leads to this error so I tried the same thing with Google Chrome. Google Chrome sends a real HTTP DELETE which then returns:
"XMLHttpRequest cannot load
https://graph.facebook.com/USER_ID/scores?access_token=APP_ID|APP_SECRET.
Origin MY_DOMAIN is not allowed by Access-Control-Allow-Origin".
I think that this is a classical cross domain issue but how to solve it? I've added my domain to my facebook application (at https://developers.facebook.com/apps) and Facebook has a paragraph which is called "Delete scores for a user". So it must be possible to delete the scores (somehow)?
Because of Cross-Site-Scripting (XSS) a HTTP DELETE is not possible. But you can send a HTTP POST request with the query parameter ?method=delete, which then deletes the score.
Code Sample:
Facebook.prototype.deleteUsersHighScore = function()
{
var deleteHighScoreUrl = 'https://graph.facebook.com/'+this.user.id+'/scores?access_token='+this.application.id+'|'+this.application.secret+'&method=delete';
jQuery.ajax(
{
type: 'POST',
async: false,
url: deleteHighScoreUrl,
success: function(data, textStatus, jqXHR)
{
console.log('Score deleted.');
}
});
}
This is the Cross Domain security issue.
The fact that your error contains the message "Origin MY_DOMAIN" would tell me that somewhere in your code you have copied one of Facebook's examples but not changed the value for MY_DOMAIN to the correct domain you are using.
I would check all of your code for the value "MY_DOMAIN".
Please ignore this advice if you have changed the value to hide your actual domain in your question.
I am trying to submit a batch request to add objects via Open Graph Beta to a user's Timeline but no matter what I do I get this:
The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: egg.
I am specifying an egg property though. My requests look like this:
https://graph.facebook.com/?batch=[{'method':'POST','relative_url':'/me/my_namespace:find','egg':'http%3A%2F%2Fwww.mydomain.com%2Fmy_namespace%2Fog%2Fegg.php%3Ftypeid%3D-966','start_time':'1317439270','end_time':'1317439270'}]&access_token=<<snipped>>&method=post
I am sending egg as a url-encoded reference string to a URL that contains my open graph data -- the URL does work if I send it not as a batch but since when setting up a user's Timeline I will in some cases have to post up to 1000 actions I am trying to speed things up by batching them.
I was able to successfully delete via a batch request.
Instead of sending the 'egg' as a param of the batch object, you need to format this like a query string and send it in the body param.
Also, relative_url should not begin with a '/'
Try posting this instead...
https://graph.facebook.com/batch?access_token=TOKEN&method=post&batch=
[
{
"method": "post",
"relative_uri": "me/your_namespace:find",
"body": "egg=http%3A%2F%2Fwww.mydomain.com%2Fmy_namespace%2Fog%2Fegg.php%3Ftypeid%3D-966&start_time= 1317439270&end_time= 1317439270
}
]
I've tested this and it works.
When Posting data to the batch API, the data must be formatted like a querysting and sent in the 'body' param as a string.