The MediaRecorder class starts recording audio after a short delay

I have a problem with the MediaRecorder class. When I call the start () method, the recorder starts recording (audio), but after some delay (the delay is quite noticeable - about 1 second). I saw this on Android 2.3 devices, in particular on the Samsung Nexus S. This problem does not appear on Android 1.6 (G1) or any version of Android emulators. Could you confirm if you see this problem and if there is a solution for it? Is this a documented error?

+4
source share
3 answers

This seems to be either an error in MediaRecorder, or in the firmware of the device. You can see the same delay in the default Camera application, which also uses MediaRecorder. I also noticed that at the end of each recording there is an additional sound when the video stops. However, video and audio seem to sync throughout the video. This is something like this:

========================================= Audio being captured ========================================= Video being captured |----|----|----|----|----|----|----|----|----| Time ^ ^ start() stop() 

Thus, the sound is not really β€œshifted”, it just begins and ends after capturing the video.

I am watching the delay on a Motorola Xoom tablet running Honeycomb (Android 3.0).

See the bug report here: http://code.google.com/p/android/issues/detail?id=15953

+3
source

I found a problem (not related to CyanogenMod): https://github.com/CyanogenMod/android_frameworks_base/commit/d7f1c3d69274fef8772a663ce1c792fd0466fcc5

This commit got between Android 2.2 and 2.3. Its purpose is to mute the default camera app sound when recording starts (although 1 second is slightly longer for this). And this should gradually fade in the sound, but the implementation does not seem to work. This is a hard cut after 1 second, you can also try this in the camera app.

I really do not understand why they implemented it at this level, where other applications are also affected. And the behavior is not configurable, so I do not see a possible workaround. We can only hope that it will be fixed in future versions.

+2
source

I added to the Android error report related to alalonde. I see this as an Android 2.3 bug, since the same code works fine on 2.2 and earlier. I have myTouch 4G, which worked perfectly on firmware 2.2 in stock. As soon as I upgraded to Cyanogen Rom based on 2.3.3, I noticed a 1 second delay. The same hardware, the same application, a different version of the OS. Must have an OS.

0
source

Source: https://habr.com/ru/post/1204013/


All Articles