tango-adb / feedback

Issue tracker for Tango Web App
https://tangoapp.dev/
GNU General Public License v2.0
2 stars 0 forks source link

[Bug] After successfully connecting, an error occurs when clicking to start the image. #15

Closed yaomoshen520 closed 7 months ago

yaomoshen520 commented 7 months ago

Pre-issue checklist

The environment Tango is running in

windows10,Chrome 115

The device you're connecting to

android10

What did you do and what happened?

The error message indicates that there is a problem with creating an AudioRecord object in your Android application. The specific error is "java.lang.UnsupportedOperationException: Cannot create AudioRecord". This could be caused by several factors:

Incorrect audio source: The audioSource value you are using is 3, which corresponds to AudioSource.MIC. Ensure that your device has a microphone and that it is functioning correctly. Insufficient permissions: The error logs also show "Permission denied" messages related to the RECORD_AUDIO permission. Make sure your app has the necessary permissions to record audio. You can add the following line to your AndroidManifest.xml file: xml

Additionally, request runtime permissions if your target SDK version is 23 or higher.

Incompatible audio configuration: The error might be due to an unsupported audio configuration. Check the audio parameters such as sample rate, channel configuration, and audio format. Ensure that they are compatible with the device's hardware capabilities. Device-specific issues: There could be device-specific issues that prevent the AudioRecord object from being created. Try testing your app on different devices to see if the issue persists. To troubleshoot the issue, you can try the following steps:

Verify that your device has a working microphone. Check that your app has the necessary permissions to record audio. Modify the audio configuration parameters to use commonly supported values, for example: java int sampleRate = 44100; int channelConfig = AudioFormat.CHANNEL_IN_MONO; int audioFormat = AudioFormat.ENCODING_PCM_16BIT; int bufferSize = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat); AudioRecord audioRecord = new AudioRecord(AudioSource.MIC, sampleRate, channelConfig, audioFormat, bufferSize); Test your app on different devices to check for device-specific issues. If the issue persists after trying these steps, you may need to investigate further or consider reporting the issue to the device manufacturer.

(Optional) Browser console output

Android: 10
Step: captureAudioRecord
audioSource: 3
Error: Error: java.lang.RuntimeException: AudioRecord creator normal failed
    at w.e.d(SourceFile:2)
    at w.g.c(SourceFile:197)
    at w.g.a(SourceFile:13)
    at f.a.run(SourceFile:1)
Caused by: java.lang.UnsupportedOperationException: Cannot create AudioRecord
    at android.media.AudioRecord$Builder.build(AudioRecord.java:741)
    at w.c.e(SourceFile:47)
    ... 4 more

java.lang.RuntimeException: AudioRecord creator native failed
    at w.e.d(SourceFile:2)
    at w.g.c(SourceFile:197)
    at w.g.a(SourceFile:13)
    at f.a.run(SourceFile:1)
Caused by: java.lang.RuntimeException: All native_setup failed
    at w.d.e(SourceFile:486)
    ... 4 more
    Suppressed: java.lang.RuntimeException: native_setup(java.lang.ref.WeakReference, android.media.AudioAttributes, [I, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, [I, java.lang.String, java.lang.Long) failed
        at w.d.e(SourceFile:472)
        ... 4 more
    Caused by: java.lang.RuntimeException: native_setup returns -20
        at w.d.e(SourceFile:439)
        ... 4 more

    at l.captureAudioRecord (https://app.tangoapp.dev/assets/client-1033e37a.js:1:5569)
    at async https://app.tangoapp.dev/assets/screen-mirror-165023da.js:7:542
    at async zs (https://app.tangoapp.dev/assets/screen-mirror-165023da.js:2:13297)
    at async https://app.tangoapp.dev/assets/screen-mirror-165023da.js:7:524
    at async Promise.all (index 2)
    at async Object.Qt [as onClick] (https://app.tangoapp.dev/assets/screen-mirror-165023da.js:3:57)
Log: 12-17 14:33:14.23.128903  4223  4508 E WifiNetworkMonitor: Not any Obervers!!!
yume-chan commented 7 months ago

Thanks for reporting!

Audio capture is not supported on Android 10, but incorrectly started, causing this error.

A new version is now online fixing this issue.