cordova-angular-angularMaterial-seed icon indicating copy to clipboard operation
cordova-angular-angularMaterial-seed copied to clipboard

Can't use additional cordova plugin (capture)

Open trahloff opened this issue 9 years ago • 0 comments

I installed the ngCapture Plugin and tried to use it but It seems like the controller can't acces it. My controller:

"use strict";

angular.module("ConnectedCarApp").controller("testCtrl",function($rootScope,$cordovaCapture, $cordovaMedia, $state, $scope, $mdSidenav, $mdComponentRegistry, $http, $timeout) {

        $scope.captureAudio = function() {
          console.log("invoked captureAudio()");
            var options = {
                limit: 3,
                duration: 10
            };

            document.addEventListener("deviceready", function() {
              console.log("capturing audio...");
                $cordovaCapture.captureAudio(options).then(function(audioData) {
                    console.log(audioData);
                }, function(err) {
                    console.log(err);
                });

            }, false);
        };

    }
);

When I run captureAudio() it only logs "invoked captureAudio()" to the console but won't even log an error. If I try to run it without the deviceready-wrapper I get an "Cannot read property 'capture' of undefined".

trahloff avatar Apr 15 '16 16:04 trahloff