CaiqueNds commented on issue #286:
URL:
https://github.com/apache/cordova-plugin-media-capture/issues/286#issuecomment-1815226090
my solution was. Instead of copying or moving the file received by the video
plugin from the device's camera folder. It was creating a blob of this file and
writing this blob directly to the desired path..
```
async workAroundBugGravacaoVideo(
path_file,
file_name,
new_path_file,
new_file_name
) {
const destinationDirectoryEntry = await this.file.resolveDirectoryUrl(
new_path_file
);
const originDirectoryEntry = await
this.file.resolveDirectoryUrl(path_file);
const fileEntry = await this.file.getFile(originDirectoryEntry,
file_name, {
create: false,
});
return this.saveBinaryFile(
fileEntry,
destinationDirectoryEntry,
new_file_name
);
}
```
```
saveBinaryFile(fileEntry, dirEntry, fileName) {
return new Promise((resolve, reject) => {
fileEntry.file(function (file) {
var reader = new FileReader();
reader.readAsArrayBuffer(file);
dirEntry.getFile(
fileName,
{ create: true, exclusive: false },
function (fileEntry) {
fileEntry.createWriter(function (fileWriter) {
fileWriter.onwriteend = function () {
resolve(null);
};
fileWriter.onerror = function (e) {
console.log("Failed file write: " + e.toString());
reject();
};
fileWriter.write(file);
});
}
);
});
});
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]