我是vimeo的新人。我只是使用链接将视频上传到vimeo。 API给了我成功,视频也上传到vimeo,但视频没有播放,并说它已损坏。这是参考网址: https://github.com/websemantics/vimeo-upload
这是代码:
%timeit self_intersect(np.random.randn(2000,(10)),0.1)
10 s ± 94.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
回应:
me.prototype.upload = function() {
var xhr = new XMLHttpRequest()
xhr.open(this.httpMethod, this.url, true)
xhr.setRequestHeader('Accept', 'application/vnd.vimeo.*+json;version=3.4')
xhr.setRequestHeader('Authorization', 'bearer xxxxxxxxxxxxxxx')
xhr.setRequestHeader('Content-Type', 'application/json')
xhr.onload = function(e) {
// get vimeo upload url, user (for available quote), ticket id and complete url
if (e.target.status < 400) {
var response = JSON.parse(e.target.responseText)
this.url = response.upload_link_secure
this.user = response.user
this.ticket_id = response.ticket_id
this.complete_url = defaults.api_url + response.complete_uri
// this.sendFile_()
} else {
this.onUploadError_(e)
}
}.bind(this)
xhr.onerror = this.onUploadError_.bind(this)
xhr.send(JSON.stringify({
"upload.approach" : "pull",
"upload.link" : "https://vimeo.com/6370469"
}))
}
请帮我解决这个问题。
答案 0 :(得分:0)
您提供的upload.link值必须是指向视频文件资源的直接链接,而不是网页。
例如,您提供了:
"upload.link":"https://vimeo.com/6370469"
您需要使用这样的视频文件的直接链接:
"upload.link":"http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi"
(这是开源电影Big Buck Bunny的SD版本的链接,通常用于测试)
Vimeo API上传文档可在此处找到:https://developer.vimeo.com/api/upload/videos#using-the-pull-approach