B4A Library AudioRecord Library

Sarah

Member
Licensed User
Longtime User
Thanks for the library and the examples Steve - much appreciated.
I have it all working using threading as shown in your sample, although I found that it worked better if I set an interrupt flag rather than calling Interrupt on the thread itself.

I am a newcomer to this platform and have been reading about the various options as I go and I was wondering is a service module would be better than threading? I have no idea how to go about implementing a service module, but it seems to me that it is designed to be an alternative to threading.

Regards,
Sarah
 

Gary Milne

Active Member
Licensed User
Longtime User

Hi Steve, is this library still functional? I tried the sample today with B4A 4.30 and it does not do anything on screen. If I add a Log statement in the Rec_Ended routine I get the following: Thread Rec EndedOK false Exception : Wrong number of arguments; expected 4, got 0.

I looked for an updated sample but did not find any. What am I missing?

Thx.
 

ilan

Expert
Licensed User
Longtime User
hi @stevel05

i am using your audio record lib for my new call recorder. thank you very much for this lib and i was able to use it on my galaxy s5.
few members here tried it on their Android 6 phones and the recording does not start. The AR is not able to intialize even if you change the sample rate.

Do you have any idea what i can do to make it work on android 6?

thanx, ilan
 

ilan

Expert
Licensed User
Longtime User

ilan

Expert
Licensed User
Longtime User
On some devices its working and on some not.

Could it be something with the saving of the wav file?

The library worked for me on my galaxsy s5 with android 5 but with android 6 i am not able to hear the other side (call recording). But galaxsy s6 is working also with android 6.

Do you have an idea what it could be?
 

stevel05

Expert
Licensed User
Longtime User
What source are you using to record the call?
 

ilan

Expert
Licensed User
Longtime User
This is a good question.

The audio source for call recording is 4 but on android 6 it didnot worked after lot of test it turned out that on android 6 the microfon source will perform a call recording (both sides) so setting the source to 1 will record both sides on a call (only on android 6+)

So on my app i check for the android version and if its 6+ i set the source to 1, on android <6 i set the source to 4.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
I think your problem lies with the vendors implementation of the audio source and/or permissions. I know that call recording was never encourages (and even actively discouraged) by Google. They have changed the sources and permissions in the past to try to stop this being possible.

I have a feeling that the reason it works on some devices is that the source or permissions have not been implemented to Googles specifications by those vendors. I know that I tried it to answer a question on the forum a few years ago and the Mic didn't record both sides of the conversation. If it's working on some but not others. this seems the most likely scenario. I don't think there is anything that can be done within the library to change it.

What is your targetSDK version for the app? Does it work as it used to if it's set to < 23?

On 23+ It may be worth trying VOICE_CALL (4) and requesting the permission. It may work on some devices if it's not implemented correctly, but I don't think you will get a 100% solution because Google doesn't want it to work.
 

ilan

Expert
Licensed User
Longtime User
ok i tried it with targetsdk 23 and ask for all permissions (dangerous permissions) and no luck.
the call is recording only on my side but not the other side.

i have tried several call recorder and most wont work with my phone (after updating to android 6) but ACR is working fine.

i wonder how they have solved the problem. but there app (ACR) works
 

ilan

Expert
Licensed User
Longtime User
Thanx steve i will try it.
Btw can your lib save the audio to 3gp or mp4 like in the source?

B4X:
private static final String AUDIO_RECORDER_FILE_EXT_3GP = ".3gp";
private static final String AUDIO_RECORDER_FILE_EXT_MP4 = ".mp4";
private static final String AUDIO_RECORDER_FOLDER = "AudioRecorder";
 

stevel05

Expert
Licensed User
Longtime User
No, that example is based on Mediarecorder, which is available as part of the AudioRecordApp or Audiostreamer objects of the Audio library. You may need to use JavaObject on it to access all of the required functions.
 

ilan

Expert
Licensed User
Longtime User
Thanx steve. Good to know that it may be possible to save the file as 3gp.

I just need to figure out how to do it with the java object.
 

stevel05

Expert
Licensed User
Longtime User
I haven't tried it, but I would think that the returned buffer should be in the correct format to save directly to a file of the requested file type. So you may not need to do anything else with it.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…