While there are multiple questions about this subjecton stackoverflow and all over the web, like:
- MediaRecorder class starts recording audio after slight delay
- Why is MediaRecorder delaying the start of recording?
- MediaRecorder Silence at Beginning of Recording (Delay?)
- Issue 15953: MediaRecorder class starts recording audio after slight delay
These links are all from like 2010 to about 2013, whereas no definitive solution has yet been found.
My situation looks like this:
- User Clicks on 'Record'
- I start polling the getMaxAmplitude()
- When the amplitude is bigger than some value, lets say 5000, I start my MediaRecorder. (functional requirement)
- The MediaRecorder both records Video AND Audio.
- User clicks 'Stop recording' saving the output as an .mp4 file.
I expected the MediaRecorder to record both the video and the audio at all times. Unfortunately this is not the case.
As seen in the first link there is a delay, thus not recording the beginning (which is the most important part of the recording in my case). A possible solution would be to use the AudioRecorder or the RehearsalAudioRecorder. They, unfortunately, only record Audio.
How would I counter this problem?