Error : windows.audioinput not available while trying a Cordova plugin

We are trying to integrate a Cordova plugin to record the voice in WAV format

https://github.com/edimuj/cordova-plugin-audioinput/tree/1.0.2


But while doing so, we are getting an error as "window.audioinput in not available"

We also tried using window.navigator object but faced same issue.


has anyone idea about what could be the problem and root cause.?

If there is any other way to get an audio file in WAV format, do let know.


thanks in advance.



Hi Gaurav,


Did you follow these steps ?

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/Mobile_Plugins/Using_Cordova_Plugins


maybe just change window.audioinput for window.plugins.audioinput

Do not forget: The functionality of Cordova plugins can be tested in native mobile applications only.


Regards

Thanks Peter. Some progress and some problem :)

We have written a wrapper over this plugin and trying to invoke it from JS.

we could start recording, stop it. But after that, when we get the recorded data in a Blob, the output parameter holding the blob shows size as 0. below is the code in JS 


var encoder = new WavAudioEncoder(window.audioinput.getCfg().sampleRate, window.audioinput.getCfg().channels);


            encoder.encode([audioDataBuffer]);
            alert("audio buffer length : " + audioDataBuffer.length); // shows length of buffer > 0
            alert("Encoding WAV finished");

            var blob = encoder.finish("audio/wav");
            alert("BLOB created");
            alert("Blob size : " + blob.size); // shows length of blob > 0
            $parameters.blob = blob;
           
        alert("Param Blob size : " + $parameters.blob.size); // shows length of output parameter > 0
        alert("actual blob : " + blob);


But when we assign parameters.blob in the Client action to another variable of Binary Data type and try to get its size, it shows 0. I also tried $resolve() in the JS to see if there is any issue with asynchronous call, but same result.