eduardoewgo opened a new issue #348: FileReader.readAs*(file) returns null onloadend URL: https://github.com/apache/cordova-plugin-file/issues/348 # Bug Report FileReader.readAs*(file) returns null in **this.result** and has FileError with code: 1 (not found) with video file. ## Problem The exact same code works fine on iOS, however I can't get it to work on Android. ## Information The command below will make it easier to understand what I'm trying to do. ### Code This is already set ``` <meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap:"> ``` Actual code ``` async captureVideoErrorOnAndroid() { const printError = (e) => console.log(e); navigator.device.capture.captureVideo(function(mediaFiles) { const mediaFile = mediaFiles[0]; console.log(`capture: Got media file: ${JSON.stringify(mediaFile)}`); // note, on iOS I have to use media.localURL rather than media.fullPath // I also tried media.localURL on Android, but the results are the same window.resolveLocalFileSystemURL(mediaFile.fullPath, function(fileEntry){ console.log(`capture: Got fileEntry: ${JSON.stringify(fileEntry)}`); fileEntry.file(function (file) { console.log(`capture: Got file: ${JSON.stringify(file)} `); const reader = new FileReader(); reader.onloadend = function() { console.log(`capture: result: ${this.result}, error: ${JSON.stringify(this.error)}`); }; reader.readAsArrayBuffer(file); }, printError); }, printError) }, printError, {limit: 1, quality: 0, duration: 10}) } ``` ### Output for iOS (working just fine) ``` capture: Got media file: {"name":"58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV","localURL":"cdvfile://localhost/temporary/58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV","type":"video/quicktime","lastModified":null,"lastModifiedDate":1563995943708.5723,"size":87457,"start":0,"end":0,"fullPath":"/private/var/mobile/Containers/Data/Application/B8A6D1DC-72B7-4F8C-A106-A137E358E0AA/tmp/58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV"} (cordova.js, line 1732) capture: Got fileEntry: {"isFile":true,"isDirectory":false,"name":"58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV","fullPath":"/58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV","filesystem":"<FileSystem: temporary>","nativeURL":"file:///var/mobile/Containers/Data/Application/B8A6D1DC-72B7-4F8C-A106-A137E358E0AA/tmp/58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV"} (cordova.js, line 1732) capture: Got file: {"name":"58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV","localURL":"cdvfile://localhost/temporary/58568874201__E85C0792-08F4-4652-9776-9E0815101786.MOV","type":"video/quicktime","lastModified":1563995943708.5723,"lastModifiedDate":1563995943708.5723,"size":87457,"start":0,"end":87457} (cordova.js, line 1732) capture: result: [object ArrayBuffer], error: null (cordova.js, line 1732) ``` ### Output for Android (with result being null) ``` capture: Got media file: {"name":"VID_20190725_030555.3gp","localURL":"cdvfile://localhost/sdcard/DCIM/Camera/VID_20190725_030555.3gp","type":"video/3gpp","lastModified":null,"lastModifiedDate":1563995159000,"size":75157,"start":0,"end":0,"fullPath":"file:///storage/emulated/0/DCIM/Camera/VID_20190725_030555.3gp"} capture: Got fileEntry: {"isFile":true,"isDirectory":false,"name":"VID_20190725_030555.3gp","fullPath":"/DCIM/Camera/VID_20190725_030555.3gp","filesystem":"<FileSystem: sdcard>","nativeURL":"file:///storage/emulated/0/DCIM/Camera/VID_20190725_030555.3gp"} capture: Got file: {"name":"VID_20190725_030555.3gp","localURL":"cdvfile://localhost/sdcard/DCIM/Camera/VID_20190725_030555.3gp","type":"video/3gpp","lastModified":1563995159000,"lastModifiedDate":1563995159000,"size":75157,"start":0,"end":75157} capture: result: null, error: {"code":1} ``` ### Platform Android 8.0.0 ### Version information Cordova 8.1.2 cordova-plugin-file 6.0.2 ## Checklist <!-- Please check the boxes by putting an x in the [ ] like so: [x] --> - [x] I searched for existing GitHub issues - [x] I updated all Cordova tooling to most recent version - [x] I included all the necessary information above
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
