I’m trying to get the video captured with the camera to get the base64 but without success.
async takeVideo() {
let options: CaptureVideoOptions = {
limit: 1,
duration: 30,
};
this.mediaCapture.captureVideo(options).then(async (video: MediaFile[]) => {
let deviceUrl = video[0].fullPath;
let info :any = await this.file.resolveLocalFilesystemUrl(deviceUrl);
console.log(info);
if (deviceUrl.includes('/private')) {
deviceUrl = deviceUrl.replace('/private', 'file://');
}
const pathToRead = deviceUrl.substr(0, deviceUrl.lastIndexOf('/') + 1);
const nameToRead = deviceUrl.substr(deviceUrl.lastIndexOf('/') + 1);
this.file.readAsDataURL(pathToRead, nameToRead).then(result => {
console.log(result);
}),(error) => {
console.log("ERROR!")
console.log(error);
}
}
In xcode, I print the info
{"isFile":true,"isDirectory":false,"name":"69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV","fullPath":"/69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV","filesystem":"<FileSystem: temporary>","nativeURL":"file:///var/mobile/Containers/Data/Application/DEAF6F3C-AE8C-4017-A383-DE93FEE4B6D9/tmp/69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV"}
The values I send to readAsDataURL
are:
[log] - pathToRead file:///var/mobile/Containers/Data/Application/DEAF6F3C-AE8C-4017-A383-DE93FEE4B6D9/tmp/
[log] - nameToRead 69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV
And then I see these logs:
To Native Cordova -> File getFileMetadata File1360924565 ["options": [cdvfile://localhost/temporary/69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV]]
To Native Cordova -> File readAsDataURL File1360924566 ["options": [cdvfile://localhost/temporary/69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV, 0, 94579]]
To Native Cordova -> File readAsDataURL File1360924567 ["options": [cdvfile://localhost/temporary/69560062032__436D1450-8884-43A1-A0C3-214235ABD744.MOV, 0, 94579]]
After that, I do not receive anything, neither error, nor the result, i have to mention that neither readAsDataURL
and readAsArrayBuffer
nor work for me