The standard class that supports recording is the
MediaRecorder. Much like the
MediaPlayer, it passes through various states during its life cycle. The states
are as follows (for more details, view the state diagram provided by
the Developers site, at http://developer.android.com/reference/android/media/MediaRecorder.html):
MediaRecorder class is
MediaRecorder is ready to be
The media source (where the output will be placed) is configured.
MediaRecorder is prepared to
Recording is underway.
All resources are released.
To utilize the
MediaRecorder, some permissions may need to be set in the manifest:
To enable video recording,
<uses-permission android:name="android.permission.RECORD_VIDEO"/> <uses-permission android:name="android.permission.CAMERA"/>
To record audio, enable
There are three methods to record audio. The
MediaRecorder is the standard method;
Intent is the simplest
method; and the
be used to record directly from hardware buffers.
First, initialize the
MediaRecorder. Then set the data source information (the audio
input source, the output format, the encoding type, where the file
is to be recorded to, etc.). Starting with version 8, you can set the bit rate and sampling ...