Android Question Audio Streamer not working???

ilan

Expert
Licensed User
Longtime User
hi

i am trying to record via audio lib 1.63
if i use intialize(..) it is working but using intialize2(4,...) its not working

i would like to record a call so i need to change the audio source (4 = voice call)

i added the error event and it is raised when it start recording so something is not working

but if i use intialize(..) just to make a simple recording it is working only when i change the audio source it is not recording.

can somebody please help me?

thank you
 

ilan

Expert
Licensed User
Longtime User
Can you post the code that is not working and the error message from the logs?

hi erel

the code is the same like here: https://www.b4x.com/android/forum/t...5-new-audiostreamer-object.30550/#post-177599

if i use it like this it is working only if i change streamer.intialize2(4,...) it doesnot work. even if i use any other audio source like 0 (DEFAULT) or 2 (MIC) it is not working.

i am using a service to record the call.

i could not find anywhere in the forum how the error event looks like
so i just write:

B4X:
'Sub streamer_Error
'    Log("error")
'End Sub

and i see that it is raised but have no error msg.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Check the unfiltered logs and check the value of Log(LastException).

ok @Erel i tested it and i found out that the Service_Start is always called twice what leaded to intialize twice audio streamer and that caused the error
so i put a Boolean "recording" that changes from false to true on the first time service start is called and only if recording = false the stream is intialized and it
is working now like a charm

the only thing i could not understand why is service start called twice??

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Service (starter) Create **
** Service (starter) Start **
** Service (callrecsag) Create **
** Service (callrecsag) Start **
CallerID=xxx
RINGING
** Service (callrecsag) Start **
CallerID=xxx
RINGING
** Service (callrecsag) Start **
OFFHOOK
** Service (callrecsag) Start **
OFFHOOK
** Service (callrecsag) Start **
IDLE
** Service (callrecsag) Start **
IDLE
** Service (callrecsag) Start **
OFFHOOK
** Service (callrecsag) Start **
OFFHOOK
** Service (callrecsag) Start **
IDLE
** Service (callrecsag) Start **
IDLE

you can see that on ringing service start was called twice and on offhook (when call is active) and also on idle (when call is ended)

i have this in my manifest:

AddReceiverText(callrecsag,
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>)

should it be like this that the service is called twice? or is there a problem?
 
Upvote 0
Top