merri-ment commented on issue #398: URL: https://github.com/apache/cordova-plugin-file/issues/398#issuecomment-651432022
For people looking for a similar solution. I managed to save the mp4 to the ios Library / Photos App by using this forked version of cordova-plugin-photo-library; https://github.com/tien271/cordova-plugin-photo-library-wkwebview Heres the updated code example; ``` const myVideoBlob = new Blob([data.buffer], { type: 'video/mp4' }) let folderPath = Env.ios ? window.cordova.file.documentsDirectory : window.cordova.file.externalDataDirectory let filename = 'video.mp4' window.resolveLocalFileSystemURL(folderPath, (dir) => { dir.getFile(filename, { create: true }, (file) => { file.createWriter( (fileWriter) => { fileWriter.onwriteend = function() { // fileWriter - onwriteend :: save file to ios Library window.cordova.plugins.photoLibrary.saveVideo(file.nativeURL, 'myVideoAlbum', function() { // photoLibrary - on save :: remove fileEntry from temp storage file.remove(function(file) { // photoLibrary - on file deleted :: mission complete }, function(error) { console.log("error occurred: " + error.code) }, function() { console.log("file does not exist"); }); }, function(err) { console.log(err) }); }; fileWriter.onerror = (err) => console.log(err) fileWriter.write(myVideoBlob); }, (err) => console.log(err) ) }, (err) => console.log(err) ); }, (err) => console.log(err) ) ``` I'm surprised this isn't achievable using only the cordova-plugin-file plugin ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
