I'm having troubles reading a Vimeo video using the OEMBED api with jQuery.
My javascript is
function loadVideo(params, callback) {
$.ajax({
type : "GET",
url : "http://www.vimeo.com/api/oembed.json",
data : params,
dataType : "json",
success : function(result) {
alert("calling callback");
callback(result);
},
error : function(error) {
var s = "";
$.each(error, function(name, value){
s += name + ": " + value + "\n";
});
alert(s);
}
});
};
and I call this function like that
loadVideo({
"url" : $(this).attr("url"),
"title" : $(this).attr("show-title"),
"byline" : $(this).attr("show-byline"),
"portrait" : $(this).attr("show-portrait"),
"color" : "ffffff",
"width" : 120
}, function(result) {
alert("Setting video content");
$(this).html(unescape(result.html));
});
where $(this) is the element where the video has to be loaded.
Inspecting the request
Request URL:http://vimeo.com/api/oembed.jsonurl=https%3A%2F%2Fvimeo.com%2F38578157&title=false&byline=false&portrait=false&color=ffffff&width=120&callback=%3F
Request Headers
Referer:http://localhost:8080/artwriter/art
User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1
Query String Parameters
url:https://vimeo.com/38578157
title:false
byline:false
portrait:false
color:ffffff
width:120
This request looks correct (and effectively if I copy and paste in my browser I get this json result
{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"http:\/\/vimeo.com\/","title":"Test video 1","author_name":"Stefano Cazzola","author_url":"http:\/\/vimeo.com\/user10866085","is_plus":"0","html":" <iframe src=\"http:\/\/player.vimeo.com\/video\/38578157?title=0&byline=0&portrait=0&color=ffffff\" width=\"120\" height=\"90\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen><\/iframe>\n\n\n","width":120,"height":90,"duration":165,"description":"","thumbnail_url":"http:\/\/b.vimeocdn.com\/ts\/265\/600\/265600694_100.jpg","thumbnail_width":100,"thumbnail_height":75,"video_id":38578157}
However something goes wrong and I end up in the ajax error callback.
Any ideas?