1
是否有人通過React Native Formdata()成功上傳視頻?下面的代碼試圖從相機膠捲URI上傳一個.mov文件,但實際上只有視頻的第一幀(JPEG)被上傳。這裏有什麼問題?使用formdata在視頻中上傳視頻
var movVideo = {
uri: uriFromCameraRoll,
type: 'video/quicktime',
name: 'something.mov',
};
var body = new FormData();
body.append('video', movVideo);
body.append('title', 'A beautiful video!');
fetch('https://mysite/upload_asset', {
method: "POST",
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data'
},
body: body,
}).then((response) => response.json())
.then((responseJson) => {
//only the first frame of the video got uploaded
console.log(responseJson);
});
extrabacon =天才 – Keng