javascript - Cordova Media Plugin Record audio Error -


i built android application record audio using cordova media plugin.

when press record button, creates audio file.

once recoding complete:

  • if press button audio file empty.
  • if go location pressing home key audio file ok , playable.

how can fix behaviour when using button?

.controller('mycontroller', function($scope, $ionicplatform, $cordovamedia,$cordovadevice , $timeout, $interval) {      $scope.timerwithinterval = 0;    //$ionicplatform.ready(function() {      try {              $scope.timerwithinterval = 0;      var mediarec;        $scope.startrecord = function() {          $scope.timerwithinterval = 0;        if($scope.myinterval){          $interval.cancel($scope.myinterval);        }        $scope.oninterval = function(){           $scope.timerwithinterval++;        }        $scope.circle = "outer-circle-active";        $scope.myinterval = $interval($scope.oninterval,1000);          var random = math.floor((math.random() * 100000) + 1);        var src = "myrecording_"+random+".mp3";          $scope.mmediarec = new media(src,        // success callback        function(e) {          console.log("recordaudio():audio success");        },          // error callback        function(err) {          console.log("recordaudio():audio error: "+ err.code);        });            // record audio        $scope.mmediarec.startrecord();      };          $scope.stoprecord = function() {        $scope.timerwithinterval = 0;        $interval.cancel($scope.myinterval);        $scope.staus = "successfully saved";        $scope.mmediarec.stoprecord();        mediarec.release();      };        } catch (e) {        console.warn("ondeviceready error: " + e)        alert("ondeviceready error: " + e);      }    //});  })


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -