Search code examples
androidcordovaaudiophonegaprecording

Phonegap record sound. Save to a file after when something heard


is there any plugin that could catch the sound and save it? So it would wait for some sound threshold and only then would start writing sound to file or just could ping, that the any sound was heard?


Solution

  • Try this: cordova-plugin-sound-meter

    Use this code to initiate the detection:

    window.soundMeterPlugin.getAmplitude(function(e){
        //success callback
        alert(e["amplitude"]);
        }, function(e){
        //error callback
        alert('The error is: ' + e);
    });
    

    On Success callback, You can start to record audio using Cordova Media Capture to Record Audio