react-native-sound icon indicating copy to clipboard operation
react-native-sound copied to clipboard

incoming phone call failed occasionally while my app running with RNSound

Open ShuminY opened this issue 1 year ago • 0 comments

My app plays mp3 and wav sound with RNSound v 0.11.2. When it's running on android (actually a HuaWei phone), sometimes incoming phone call fails and the logcat prints exceptions like below. Any idea what's happened? 2025-09-17 20:34:58.512 15997-15997 AndroidRuntime com.android.phone E FATAL EXCEPTION: main Process: com.android.phone, PID: 15997 java.lang.RuntimeException: Unable to create service com.android.phone.recorder.RecorderServer: java.lang.RuntimeException: Unable to initialize media recorder at android.app.ActivityThread.handleCreateService(ActivityThread.java:4834) at android.app.ActivityThread.access$3000(ActivityThread.java:259) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2481) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8679) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109) Caused by: java.lang.RuntimeException: Unable to initialize media recorder at android.media.MediaRecorder.native_setup(Native Method) at android.media.MediaRecorder.(MediaRecorder.java:155) at android.media.a.h.(Unknown Source:53) at com.android.phone.recorder.z.b(Unknown Source:21) at com.android.phone.recorder.RecorderServer.onCreate(Unknown Source:41) at android.app.ActivityThread.handleCreateService(ActivityThread.java:4820) at android.app.ActivityThread.access$3000(ActivityThread.java:259)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2481)  at android.os.Handler.dispatchMessage(Handler.java:110)  at android.os.Looper.loop(Looper.java:219)  at android.app.ActivityThread.main(ActivityThread.java:8679)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109) 

I preload the audios into an array during app initialization like below:

Image

And when an audio is to be played, put its name into a queue. The audio will be played one by one like below:

Image

The app itself runs properly. But just sometimes incoming phone call got failed. And once it fails all following incoming phone calls fail until I quit/close the app. Any guidance will be really appreciated.

ShuminY avatar Sep 18 '25 03:09 ShuminY