[英]How to use vimeo-upload in node.js?
I am going to upload the video to my app of vimeo in Node/Express. 我将视频上传到Node / Express中的vimeo应用程序。 I had googling and found the package to upload the video to the vimeo, it's the vimeo-upload. 我进行了谷歌搜索,找到了将视频上传到vimeo的包,这是vimeo上传。
But I am not sure how to use it. 但是我不确定如何使用它。 Its the format is like following. 其格式如下。
var uploader = new VimeoUpload({
file: file,
token: accessToken,
});
uploader.upload();
I got the accesstoken in my project and think file is the binary of video. 我在项目中获得了访问令牌,并认为文件是视频的二进制文件。
The problem is to get the binary from video. 问题是要从视频中获取二进制文件。
Please help me! 请帮我!
I found the issues of vimeo-upload.js as the API version of vimeo was upgraded. 在升级vimeo的API版本时,我发现了vimeo-upload.js的问题。
The function upload() in the vimeo-upload.js, the url was changed like following. vimeo-upload.js中的函数upload(),URL如下更改。
me.prototype.upload = function() {
var xhr = new XMLHttpRequest()
xhr.open(this.httpMethod, this.url, true)
xhr.setRequestHeader('Authorization', 'Bearer ' + this.token)
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.upload_link
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({
type: 'streaming',
upgrade_to_1080: this.upgrade_to_1080
}))
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.