Custom Audio Capture
Of course, using an intent to trigger the sound recorder isn't the only way we can capture audio. The Android SDK includes a
MediaRecorder class, which we can leverage to build our own audio recording functionality. Doing so enables a lot more flexibility, such as controlling the length of time audio is recorded for.
MediaRecorder class is used for both audio and video capture. After constructing a
MediaRecorder object, to capture audio, the
setAudioSource methods must be called. If these methods are not called, audio will not be recorded. (The same goes for video. If
setVideoSource methods are not called, video will not be recorded. We won't be dealing with video in this chapter; ...