kryops opened a new issue #671:
URL: https://github.com/apache/cordova-plugin-camera/issues/671


   # Bug Report
   
   ## Problem
   
   When specifying `DestinationType.FILE_URI`, the URL types on Windows UWP are 
different for images captured by the camera than they are for images selected 
from the hard drive.
   
   ### What is expected to happen?
   
   The URLs returned by this plugin should have the same type independent of 
the picture source.
   
   ### What does actually happen?
   
   * `Camera.PictureSourceType.CAMERA` => `ms-appdata:///local/CCapture.jpg`
   * `Camera.PictureSourceType.SAVEDPHOTOALBUM` => 
`blob:ms-appx://<APPID>/<GUID>`
   
   ## Information
   
   Before 5.0.0, we used `Camera.DestinationType.NATIVE_URI` on Windows UWP, 
which would return URLs similar to what `Camera.PictureSourceType.CAMERA` does. 
However, this destination type was removed in 
https://github.com/apache/cordova-plugin-camera/pull/637
   
   With 5.0.0, the best workaround I could come up with was patching 
`CameraProxy.js`:
   
   ```
   const newContent = fileContent.replace(
     /successCallback\(URL\.createObjectURL\(storageFile\)\);/g,
     "successCallback('ms-appdata:///local/' + storageFile.name);"
   );
   ```
   
   Is there a reason why the Blob URLs were chosen as `FILE_URI` for Windows 
UWP? Could they be replaced by the URLs formerly returned for `NATIVE_URI`?
   
   Note: https://github.com/apache/cordova-plugin-camera/pull/668 seems to 
already change this behavior
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   
   Complete options:
   
   ```
   {
       quality: 50,
       destinationType: Camera.DestinationType.FILE_URI,
       sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM,
       encodingType: Camera.EncodingType.JPEG,
       mediaType: Camera.MediaType.PICTURE,
       allowEdit: false,
       correctOrientation: true,
       targetWidth: 1920,
     }
   ```
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   
   Windows UWP, Windows 10/2004
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   cordova 10.0.0
   cordova-windows 7.0.1
   cordova-plugin-camera 5.0.0
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
     - #496 seems to be related
   - [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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to