markerio edited a comment on issue #506: iOS13 file_uri error picking video 
from gallery
URL: 
https://github.com/apache/cordova-plugin-camera/issues/506#issuecomment-557928177
 
 
   @saurabhDuzumaki @neerajsaxena0711 Please find below the simplest 
implementation of picking a video from the camera roll in iOS13. Tested in all 
v13 releases including the latest v13.2.3. 
   
   First, please follow @litiobat fix and change **CDVCamera.m** file as 
suggested. I forked the master plugin and applied @litiobat's fix, here is the 
link for any of you guys interested in this fork:
   
   `<plugin spec="https://github.com/markerio/cordova-plugin-camera.git"; 
source="git" />`
   
   Then, setup the plugin to retrieve a video from the device's gallery. The 
picker should be triggered as follows:
   ```
   navigator.camera.getPicture(onSuccess, onFail, {
     saveToPhotoAlbum: false,
     correctOrientation: true,
     allowEdit: false,
     mediaType: Camera.MediaType.VIDEO,
     sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
     destinationType: Camera.DestinationType.FILE_URI
     });
   ```
   The success callback should be as follows:
   ```
   function onSuccess(fileURI) {
     // fix path for file:// protocol
     fileURI = 
(parseInt(fileURI.indexOf('file://'))==0)?fileURI:'file://'+fileURI;
     // resolve and locate file
     window.resolveLocalFileSystemURL(fileURI, function success(fileEntry) {
       // retrieve file entry
       fileEntry.file(function(fileObj) {
         // debug
         console.log(fileEntry.nativeURL);
         console.log(fileObj.localURL);
         console.log(fileObj.name);
         console.log(fileObj.size);
         // continue from here
         // ...
         // ...
       }, function(error) {
         console.log('file entry error');
         });
     }, function (error) {
       console.log('resolve error');
       });
     }
   ```
   Please reply back if you find this helpful. Hope this helps.

----------------------------------------------------------------
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]

Reply via email to