Android Question AudioStreamer release

Philip Prins

Active Member
Licensed User
Longtime User
Hello

I have one specific device that gives the following error :java.lang.IllegalStateException: stop() called on uninitialized AudioTrack.

I found this code on the forum to release the AudioRecord:
B4X:
Dim r As Reflector
    r.Target = audioStreamTx
    r.Target = r.GetField("audioRecord")
    r.RunMethod("release")

How to release AudioTrack,?
I tried r.getField audioTrack but get this error :java.lang.NoSuchFieldException: No field audioTrack in class Lanywheresoftware/b4a/audio/AudioStreamer; (declaration of 'anywheresoftware.b4a.audio.AudioStreamer' appears in /data/app/comm.check.wf-2/base.apk)
 

stevel05

Expert
Licensed User
Longtime User
Try r.GetField("track"), but if it is uninitialized you probably won't be able to call it as it has acquired no resources and you are likely to get the same error.
 
Upvote 0

Philip Prins

Active Member
Licensed User
Longtime User
Try r.GetField("track"), but if it is uninitialized you probably won't be able to call it as it has acquired no resources and you are likely to get the same error.
Hello Steve ,

Thanks but it doesn't work.
Same error .
Unable to initialise, it is on one specific device , on other devices no problems
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You need to check that the device supports audio with the settings you are initalizing the Streamer object with.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I am a bit out of touch with the Android lifecycle in relation to services, haven't done anything like that for a while, but it sounds like the objects are being released by the system. If you can post your code (export as zip if possible) I'm sure you will get a concrete answer.
 
Upvote 0
Top