React native 如何在react native中将视频上传到vimeo?
我在用react native将视频上传到vimeo时遇到问题 我试着把手机里的视频上传到vimeo上 URI是React native 如何在react native中将视频上传到vimeo?,react-native,file-upload,React Native,File Upload,我在用react native将视频上传到vimeo时遇到问题 我试着把手机里的视频上传到vimeo上 URI是this.state.URI,它是指向我的视频的文件路径,例如:file:///data/user/Camera/e520ecbb-e226-434c-8c8d-305621622645.mp4 这是我的代码: var fileAsString = await FileSystem.readAsStringAsync(this.state.uri) var file = ne
this.state.URI
,它是指向我的视频的文件路径,例如:file:///data/user/Camera/e520ecbb-e226-434c-8c8d-305621622645.mp4
这是我的代码:
var fileAsString = await FileSystem.readAsStringAsync(this.state.uri)
var file = new File([fileAsString], "video.mp4");
var upload = new tus.Upload(file, {
endpoint: this.state.vimeoUploadLink,
retryDelays: [0, 1000, 3000, 5000],
metadata: {
filename: "video.mp4",
filetype: "video/mp4"
},
onError: function(error) {
console.log("Failed because: " + error)
},
onProgress: function(bytesUploaded, bytesTotal) {
var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2)
console.log(bytesUploaded, bytesTotal, percentage + "%")
},
onSuccess: function() {
console.log("Download %s from %s", upload.file.name, upload.url)
}
})
但我有一个错误:
unexpected response while creating upload, originated from request (response code: 405, response text: Method Not Allowed)
这是正确的方法吗?我怎么了