Search code examples
javascriptjqueryaudio-recordingrecorder.js

"Error getting audio" in audio record using Recorder.js


I am using this example Recorder.js Demo for recording audios. It's working fine in Linux, but when I use it on Windows. It gives the alert "Error getting audio", For this code is as below

function initAudio() {
        //Some code

    navigator.getUserMedia(
        {
            "audio": {
                "mandatory": {
                    "googEchoCancellation": "false",
                    "googAutoGainControl": "false",
                    "googNoiseSuppression": "false",
                    "googHighpassFilter": "false"
                },
                "optional": []
            },
        }, gotStream, function(e) {
            console.log("In gotStream function :" +e);
            alert('Error getting audio');
            console.log(e);
        });
}

Any thoughts on this?


Solution

  • I have resolved my problem. The problem is that Chrome has recently changed to require secure origins for all powerful APIs, in particular getUserMedia. I have to run this on https://host not on http://host, otherwise getUserMedia will be failed.