React native 如何使用React Native将视频上传到s3 bucket
如何使用React Native将视频文件上载到s3存储桶中。现在我正在制作一个应用程序,我可以将图像上传到s3存储桶中,但我不知道如何将视频文件上传到s3存储桶中。我想知道怎么做React native 如何使用React Native将视频上传到s3 bucket,react-native,amazon-s3,video-streaming,React Native,Amazon S3,Video Streaming,如何使用React Native将视频文件上载到s3存储桶中。现在我正在制作一个应用程序,我可以将图像上传到s3存储桶中,但我不知道如何将视频文件上传到s3存储桶中。我想知道怎么做 谢谢,您首先需要一个库来访问您的文件,在您访问视频文件后,您可以通过以下方式上载: const form = new FormData(); const video = this.state.video; form.append("video", { uri: video.uri, type: video.t
谢谢,您首先需要一个库来访问您的文件,在您访问视频文件后,您可以通过以下方式上载:
const form = new FormData();
const video = this.state.video;
form.append("video", {
uri: video.uri,
type: video.type,
name: video.fileName
});
//build payload packet
var postData = {
method: 'POST',
body: form,
headers: {
'Content-Type': 'multipart/form-data'
},
}
fetch('/post_url', postData)
.then((response) => {
return response.json();
}).then((responseJson) => {
console.log('responseJson', responseJson);
})
.catch((error) => {
console.log('error', error);
});
更新到RN 0.57后,我们也遇到了一个问题,无法像以前那样上传视频。 然后我们使用了这个软件包: 它很旧,但可以在ios和android上使用。希望这有帮助