Reputation: 1742
I have a single-user application,
in Vimeo's playground, when doing video/{id}, i get a big JSON result that contains:
"files": [
{
"quality": "hd",
"type": "video/mp4",
"width": 1920,
"height": 1080,
"link": "...link...",
"created_time": "2018-02-15T13:46:25+00:00",
"fps": 23.980000000000000426325641456060111522674560546875,
"size": 3113207678,
"md5": "b6beed65b699df870e481045178accc5",
"link_secure": "...link..."
},
{
"quality": "sd",
"type": "video/mp4",
"width": 640,
"height": 360,
"link": "...link...",
"created_time": "2018-02-15T13:46:05+00:00",
"fps": 23.980000000000000426325641456060111522674560546875,
"size": 536864946,
"md5": "af227a5526af15d2bce6ac951d6cf06b",
"link_secure": "...link..."
},
{
"quality": "sd",
"type": "video/mp4",
"width": 960,
"height": 540,
"link": "...link...",
"created_time": "2018-02-15T13:46:05+00:00",
"fps": 23.980000000000000426325641456060111522674560546875,
"size": 1242328160,
"md5": "1963f908509b14fd7a40dc46bfa6c519",
"link_secure": "...link..."
},
{
"quality": "hd",
"type": "video/mp4",
"width": 1280,
"height": 720,
"link": "...link...",
"created_time": "2018-02-15T13:46:05+00:00",
"fps": 23.980000000000000426325641456060111522674560546875,
"size": 1977386604,
"md5": "af38f067bd39f4f5bb71bad72f925337",
"link_secure": "...link..."
},
{
"quality": "hls",
"type": "video/mp4",
"link": "...link...",
"created_time": "2018-02-15T13:46:25+00:00",
"fps": 23.980000000000000426325641456060111522674560546875,
"size": 3113207678,
"md5": "b6beed65b699df870e481045178accc5",
"link_secure": "...link..."
}
(i edited the urls out)
but when doing the same call in my code, the whole "files" section is missing (also the whole json result looks different):
this is my code, the call:
vc.Request("/videos/255898412", null, "GET");
request method:
public Dictionary<string, object> Request(
string url,
Dictionary<string, string> parameters,
string method,
bool jsonBody = true)
{
var headers = new WebHeaderCollection()
{
{ "Authorization", String.Format("Bearer {0}", AccessToken) }
};
method = method.ToUpper();
url = apiRoot + url;
string body = "";
string contentType = "application/x-www-form-urlencoded";
if (parameters != null && parameters.Count > 0)
{
if (method == "GET")
{
url += "?" + Helpers.KeyValueToString(parameters);
}
else if (method == "POST" || method == "PATCH" || method == "PUT" || method == "DELETE")
{
if (jsonBody)
{
contentType = "application/json";
body = jsonEncode(parameters);
}
else
{
body = Helpers.KeyValueToString(parameters);
}
}
}
return JsonConvert.DeserializeObject<Dictionary<string, object>>(Helpers.HTTPFetch(url, method, headers, body, contentType));
}
My goal is to get the HLS direct link, to play it in my player . How can i achieve it?
Thanks
Upvotes: 1
Views: 4718
Reputation: 3018
There was a bug where the download and files keys were not returning for devs using API v3.4. Vimeo has since fixed the bug (as of 2/23/2018).
Starting with API v3.4, developers must authenticate requests using a token with the video_files
scope to receive the download and files keys in the video response.
If you're generating tokens using the OAuth workflow, you can generate a token with the video_files scope that way: https://developer.vimeo.com/api/authentication#supported-scopes
I hope this information helps!
Upvotes: 1
Reputation: 26
I also encountered the same problem today.
My stupid solution is as follows.
Upvotes: 1