Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Eror plugin is not defined (cordova-plugin-media)

$
0
0

@RehatulAmbar wrote:

hi, I have tried to build Ionic recorder, I user cordova-plugin-media and it's installed successfully at command prompt, but "Media"(var mediaRec = new Media(src) in my controller is not defined

here is my controller :
`

$scope.recordAudio = function() {
    var src = "mymedia.mp3";
    var mediaRec = new Media(src,
        // success callback
        function() {
            console.log("recordAudio():Audio Success");
        },

        // error callback
        function(err) {
            console.log("recordAudio():Audio Error: "+ err.code);
        });

    // Record audio
    mediaRec.startRecord();

     // Stop recording after 10 seconds
    setTimeout(function() {
        mediaRec.stopRecord();
    }, 10000);
}

// Play audio
//
$scope.playAudio=function(url) {
    // Play the audio file at url
    var my_media = new Media(url,
        // success callback
        function () {
            console.log("playAudio():Audio Success");
        },
        // error callback
        function (err) {
            console.log("playAudio():Audio Error: " + err);
        }
    );
    // Play audio
    my_media.play();
}

I have tried to add that plugin again, I have tried to update the cordova, but it's does not work.
here is my eror :

if someone know what should I do, please help~
thanks :blush:

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>