Android : capture audio



Samuel

Hello to all

Does somebody know a Cordova plugin which does media capture without requesting the native recording app to be opened, please ? I have searched for one and did not found any.

The issue related to that problem is the format : on some devices, when I try to capture the audio, the native app opens and returns a .arm file and on others, the app receives nothing with an error code.

I have already tried using a web page too but the embedded browser doesn't request for the audio permission and nothing is returned.

Many thanks


David

Hello Samuel,

I think the cordova-plugin-media can be a good candidate to be used. Apparently it's an official plugin of Apache Cordova. Note, however, that the file format need some attention, for example, in the Android platform.


Consider to purchase one or more licenses of our products if they are useful to you!

Samuel

Thanks a lot David. I thought it was the one embedded with App Builder. I give it a try.


David

Hello Samuel,

Thanks a lot David. I thought it was the one embedded with App Builder. I give it a try.

In fact I don't know about this plugin until yesterday... and it's a suprise to me, because it's an Apache Cordova official plugin. You can try to use it (it's more or less easy, I already try it), but I am working into this plugin integration (at least the audio recording) in DecSoft App Builder, among the rewriting of the Cordova File plugin (which must be used to record an audio file, to create the file), among other changes.


Consider to purchase one or more licenses of our products if they are useful to you!

David

Hello Samuel,

Maybe this new AB release can be useful to you. Take a look!


Consider to purchase one or more licenses of our products if they are useful to you!

Samuel

Hello David,

Thanks a lot for this new addition. Of course it helps (and it solves).

I was working on the plugin integration and was not able to play the recorded file. So, I will be glad to learn how you solved that. A case of study.

Thanks again for having provided a solution so quickly.


David

Hello Samuel,

Your welcome! You know the Apache Cordova Media plugin allows to record audio files and to reproduce audio files. However, the integration that I made refers only to the record audio files, because, in fact, we can already reproduce audio files using Audio JavaScript objects or the AudioPlayer control.

In the case of the "CordovaMedia" sample app I use an AudioPlayer control in order to reproduce the recorded audio file. Note, however, that the "app.cordova.media.startRecord()" method, returns a "media object instance", that we must use later with the "app.cordova.media.stopRecord()".

But the referred "media object instance" is an instance of the provided plugin's object from Apache Cordova, and, this means in act that we can use this instance variable to call all the available plugin's methods described in the plugin's documentation.

Why I did not include that methods in the plugin's integration? To maintain the plugin as easy as possible, and, because, in other hand, the audio reproduction related methods did not appear interesting (since we can reproduce the audio in other ways), and because other methods are platform specific.

Maybe you enter in troubles due to the requirement of the plugin to provide a file path, in which the recorded audio must be saved. The solution is the also integrated Apache Cordova File plugin, as you can see in the "CordovaMedia" sample app. In fac the integration of the Apache Cordova file has been rewritten from the scratch in the new AB release, as you can see in the help and also in the "CordovaFile" sample app.

I recommend you to take a look at the referred "CordovaMedia" and "CordovaFile" samples, and, just post here if you have any further question about!


Consider to purchase one or more licenses of our products if they are useful to you!

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.