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

CaptureAudio - Support for Android Marshmallow

    XMLWordPrintableJSON

Details

    • Patch, Important

    Description

      By calling the captureAudio on Android Marshmallow(6.0) the audio recorder is not opened.

      My code:

       $scope.captureAudio = function() {
          var options = { limit: 1, duration: 10 };
          console.log("captureAudio");
      
          $cordovaCapture.captureAudio(options).then(function(mediaFiles) {
            console.log("Success! Audio data is here");
            var i, path, name, mime, len;
            for (i = 0, len = mediaFiles.length; i < len; i += 1) {
                path = mediaFiles[i].fullPath;
                name = mediaFiles[i].name;
                mime = mediaFiles[i].type;
                console.log("Loop: " + i + " Path: " + path + " Name: " + name + " Mime: " + mime);          
            }
          },
          function(err){
            switch (err) {
              case CaptureError.CAPTURE_NO_MEDIA_FILES:
                navigator.notification.alert('no media files', null);
                console.log('no media files');
                break;
              case CaptureError.CAPTURE_INTERNAL_ERR:
                navigator.notification.alert('internal err', null);
                console.log('internal err');
                break;
              case CaptureError.CAPTURE_INVALID_ARGUMENT:
                navigator.notification.alert('invalid arg', null);
                console.log('invalid arg');
                break;
              case CaptureError.CAPTURE_NOT_SUPPORTED:
                navigator.notification.alert('not supported', null);
                console.log('not supported');
                break;
            }
          });
        };
      

      The same code works fine on Android Lollipop(5.0).

      Attachments

        Activity

          People

            Unassigned Unassigned
            pvmaluf Paulo Victor Maluf
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: