You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/06/22 10:02:28 UTC

[GitHub] [cordova-plugin-file] merri-ment opened a new issue #398: Issue finding mp4 in Camera Roll (ios) after writing file to disk

merri-ment opened a new issue #398:
URL: https://github.com/apache/cordova-plugin-file/issues/398


   I am building an app using Cordova that generates mp4s using ffmpeg.js, the output is a blob.
   The blob is then written to disk using cordova-plugin-file.
   
   The problem is i can't find the mp4 within the Camera Roll once downloaded.
   The following code appears to run correctly, not throwing any errors and reaching the onwriteend function. I am also confident the mp4 isn't corrupt.
   
       let folderPath = Env.ios ? window.cordova.file.documentsDirectory : window.cordova.file.externalDataDirectory
       let filename = 'video.mp4'
   
       window.resolveLocalFileSystemURL(folderPath, (dir) => {
           console.log("got main dir", dir);
           dir.getFile(filename, {
                   create: true
               }, (file) => {
                   console.log("got the file", file);
                   file.createWriter(
   
                       (fileWriter) => {
   
   
                           fileWriter.onwriteend = function() {
                               console.log("onwriteend :: success writing file");
                           };
   
                           fileWriter.onerror = function(err) {
                               alert("Unable to download");
                               console.error(err);
                           };
   
                           fileWriter.write(myVideoBlob);
   
                       },
                       (err) > {
                           // failed
                           alert("Unable to download");
                           console.error(err);
                       }
                   )
   
               },
   
               (err) => {
                   alert("Unable to download");
                   console.error(err);
               }
           );
       },
   
       (err) => {
           alert("Unable to download");
           console.error(err);
       });
   
   
   I have spent a fair amount of time googling this issue and reading the docs, but i'm still not entirely sure if saving to the Camera Roll on ios is possible.
    
   
   I'm using the following dependancies;
   "cordova": "^9.0.0",
   "cordova-android": "^8.1.0",
   "cordova-ios": "^6.0.0",
   "cordova-plugin-add-swift-support": "^2.0.2",
   "cordova-plugin-android-permissions": "^1.0.2",
   "cordova-plugin-androidx": "^2.0.0",
   "cordova-plugin-androidx-adapter": "^1.1.1",
   "cordova-plugin-apprate": "^1.5.0",
   "cordova-plugin-camera": "^4.1.0",
   "cordova-plugin-dialogs": "^2.0.2",
   "cordova-plugin-file": "^6.0.2",
   "cordova-plugin-firebasex": "^9.1.2-cli",
   "cordova-plugin-inappbrowser": "^4.0.0",
   "cordova-plugin-ionic-webview": "^5.0.0",
   "cordova-plugin-nativestorage": "^2.3.2",
   "cordova-plugin-network-information": "^2.0.2",
   "cordova-plugin-purchase": "^10.0.1",
   "cordova-plugin-splashscreen": "^5.0.3",
   "cordova-plugin-whitelist": "^1.3.4",
   "cordova-plugin-wkwebview-ionic-xhr": "^2.1.1"
   
   
   
   
   Thanks,
   Cam
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] merri-ment commented on issue #398: Issue finding mp4 in Camera Roll (ios) after writing file to disk

Posted by GitBox <gi...@apache.org>.
merri-ment commented on issue #398:
URL: https://github.com/apache/cordova-plugin-file/issues/398#issuecomment-651024598


   Hey @timbru31,
   Thanks for the reply!
    
   After further investigation i found the mp4s were indeed being saved to the App's documents folder, as intended 🤦
   
   It was my misunderstanding that these mp4s would be viewable in the ios Photos App, under the videos category or even its own album folder. Do you know if this is possible using cordova-plugin-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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] timbru31 commented on issue #398: Issue finding mp4 in Camera Roll (ios) after writing file to disk

Posted by GitBox <gi...@apache.org>.
timbru31 commented on issue #398:
URL: https://github.com/apache/cordova-plugin-file/issues/398#issuecomment-648713548


   Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] merri-ment closed issue #398: Issue finding mp4 in Camera Roll (ios) after writing file to disk

Posted by GitBox <gi...@apache.org>.
merri-ment closed issue #398:
URL: https://github.com/apache/cordova-plugin-file/issues/398


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] merri-ment commented on issue #398: Issue finding mp4 in Camera Roll (ios) after writing file to disk

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org