question

Jamie Hibbard avatar image
Jamie Hibbard asked

Mic and MediaRecorder not working - have you been able to record audio?

Please see this http://stackoverflow.com/questions/21007829/meidarecorder-failing-on-kindle Problem I am having. It has been highlighted by the testing team. It works on every other android device, just not kindle.
fire tablet
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
http://developer.android.com/guide/topics/media/audio-capture.html This example works and tested in following devices: Kindle Fire HDX 8.9" (3rd Gen) Kindle Fire HDX 7" (3rd Gen) Kindle Fire HD 8.9" (2nd Gen) Kindle Fire HD 7" (2nd Gen) Kindle Fire (2nd Gen) We found below exception in Kindle Fire HD 7" (3rd Gen) while recording audio. 01-10 12:42:57.553: ERROR/StagefrightRecorder(124): audio source is not initialized 01-10 12:42:57.553: ERROR/MediaRecorder(2860): start failed: -2147483648 01-10 12:42:57.553: DEBUG/AndroidRuntime(2860): Shutting down VM 01-10 12:42:57.553: WARN/dalvikvm(2860): threadid=1: thread exiting with uncaught exception (group=0x4152d930) 01-10 12:42:57.561: ERROR/AndroidRuntime(2860): FATAL EXCEPTION: main java.lang.RuntimeException: start failed. at android.media.MediaRecorder.start(Native Method) at com.example.androidnativetest.AudioRecordTest.startRecording(AudioRecordTest.java:93) at com.example.androidnativetest.AudioRecordTest.onRecord(AudioRecordTest.java:44) at com.example.androidnativetest.AudioRecordTest.access$000(AudioRecordTest.java:31) at com.example.androidnativetest.AudioRecordTest$RecordButton$1.onClick(AudioRecordTest.java:109) at android.view.View.performClick(View.java:4265) at android.view.View$PerformClick.run(View.java:17604) at android.os.Handler.handleCallback(Handler.java:747) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:151) at android.app.ActivityThread.main(ActivityThread.java:5152) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) Can you please confirm what error you are getting?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Hibbard avatar image
Jamie Hibbard answered
Yes, as in my stack overflow 1-08 22:04:33.322: E/AudioRecordTest(2857): prepare() failed 01-08 22:04:33.322: E/MediaRecorder(2857): start called in an invalid state: 4 I unfortunately do not have a device to test and I'm testing on an emulator. However my code is taken from the same site you have quoted. I shall test on the other emulators tonight before omitting all kindle fires from using this feature of my app. It's a shame standard android code is not working and exceptions have to be made. This is clearly a bug wit the OS and will it be fixed?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Jamie, I am forwarding this issue to the appropriate team here. Please share the emulator configurations where you are getting the issue.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Kindle Fire HD 7" does not have any microphone attached, which explains the RuntimeException https://developer.amazon.com/sdk/fire/specifications.html getPackageManager().hasSystemFeature("android.hardware.microphone") is returing true for this particular device which is not expected. We have raised this to the concerned team and it would be fixed in subsequent release. Once it's fixed you can use this API for feature detection to check if microphone is available or not.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.