I’m using Capacitor 3 and Ionic 6 angular on Android 11.
I’ve used the media capture plugin for recording a video and i get a result like this:
[MediaFile]
0: MediaFile
end: 0
fullPath: "file:///storage/emulated/0/DCIM/Camera/20210522_185343.mp4"
lastModified: null
lastModifiedDate: 1621702425000
localURL: "cdvfile://localhost/sdcard/DCIM/Camera/20210522_185343.mp4"
name: "20210522_185343.mp4"
size: 13596835
start: 0
type: "video/mp4"
__proto__: File
length: 1
Am using the file plugin to upload it to the s3 server but when i use the file plugin as below it neither throws any error nor gets into the response.
this.file.readAsArrayBuffer(fullPath, name).then(realFile => {
console.log('realFile: ', realFile);
console.log('readAsArrayBuffer: ', realFile.byteLength);
}, (err) => {
this.loading.dismiss();
console.log('readAsArrayBuffer Error: ', JSON.stringify(err));
});
I need to use the arraybuffer output to create a blob in order to upload it. But it doesn't return any response or an error.
If there is any other way to do so then please do let me know.
Earlier in ionic 5 cordova the file plugin was working.
Moreover, suggest me if i can explain it in more detail.
Thanks.
Below mentioned is my ionic info:
Ionic:
Ionic CLI : 6.19.0 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.0.11
@angular-devkit/build-angular : 13.2.6
@angular-devkit/schematics : 13.2.6
@angular/cli : 13.2.6
@ionic/angular-toolkit : 6.1.0
Capacitor:
Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3
Utility:
cordova-res : 0.15.4
native-run : 1.5.0
System:
NodeJS : v16.14.2 (/usr/local/bin/node)
npm : 8.5.0
OS : macOS Monterey
1条答案
按热度按时间eivnm1vs1#
由于zone.js Git Hub Issue,文件插件不适用于angular/ionic
要使用文件,建议使用电容器自己的FileSystemAPI,它的工作原理就像一个魅力。FileSystem API