Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13603

Android - navigator.camera.getPicture hangs with downloaded image

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 6.3.1, 2.4.1
    • None
    • cordova-plugin-camera
    • None
    • Android 8.0.0 - LG Nexus 5X

    • Important

    Description

      I have the following code:

      $('#btnBrowsePicture').on('click', function () {
          console.log("Browsing picture.");
          try {
              navigator.camera.getPicture(
                  function (fileUri) {
                      try {
                          console.log("Picture selection is success. File: " + fileUri);
      
                          _this._upload.AllInOneUploadPicture(_this._psId, fileUri, function () {
                          });
                      }
                      catch (e) {
                          console.error(e.message);
                      }
                  },
                  function (error) {
                      console.error("Picture selection error. Error: " + error);
                      },
                  {
                      destinationType: Camera.DestinationType.FILE_URI,
                      mediaType: Camera.MediaType.PICTURE,
                      sourceType: Camera.PictureSourceType.PHOTOLIBRARY
                  });
          }
          catch (e) {
              console.error(e.message);
          }
      });       
      

      When I click the button, I can see the "Browsing picture" in the Visual Studio 2017 Javascript debug console and the gallery opens. When I try to browse a picture from gallery (jpg) it is ok, but when I try a downloaded gif The application hangs with Android message: the application is shut down. Reopen the application!

      No other error message or log in the console after that in Android 8.0.0.
      In previous version I see the error message:
      "Picture selection error. Error: Selection cancelled." so this is the:

      function (error) {
        console.error("Picture selection error. Error: " + error);
      },
      

      This is the same when I use this settings with video:

      {
          destinationType: Camera.DestinationType.FILE_URI,
          mediaType: Camera.MediaType.VIDEO,
          sourceType: Camera.PictureSourceType.PHOTOLIBRARY
      });
      

      With mp4 everything works fine, but when I try to open a downloaded mov, the error occures.

      I have tested it:

      • Android 6.0.1 (Samsung Galaxy S5) (Works well)
      • Android 7.0 (Sony XPeria XA) (Works well)
      • Android 8.0.0 (Google Nexus 5x) (Error)

      Thanks in advance!

      Attachments

        Activity

          People

            Unassigned Unassigned
            dimigergo Gergely Dimitrievits
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: