Important Methods of MediaRecorder Class

Method 

Description

setAudioSource() This method will specify the source of the audio to be recorded.
setAudioEncoder() This method is used to specify the audio encoder.
setOutputFormat() This method is used to specify the output format of our audio.
setOutputFile() This method is used to specify the path of recorded audio files that are to be stored.
stop() This method is used to stop the recording process. 
start() This method is used to start the recording process. 
release() This method is used to release the resource that is associated with the Media recorder class.

Audio Recorder in Android with Example

In Android for recording audio or video, there is a built-in class called MediaRecorder. This class in Android helps to easily record video and audio files. The Android multimedia framework provides built-in support for capturing and encoding common audio and video formats. In android for recording audio, we will use a device microphone along with MediaRecorder Class and for recording video, we will use the user’s device Camera and MediaRecorder Class. Now in this article, we will see the implementation of an audio recorder in Android with an example. 

Similar Reads

Important Methods of MediaRecorder Class

Method  Description setAudioSource() This method will specify the source of the audio to be recorded. setAudioEncoder() This method is used to specify the audio encoder. setOutputFormat() This method is used to specify the output format of our audio. setOutputFile() This method is used to specify the path of recorded audio files that are to be stored. stop() This method is used to stop the recording process.  start() This method is used to start the recording process.  release() This method is used to release the resource that is associated with the Media recorder class....

Example

Now we are creating a simple audio recorder app in which we will record audio from users device microphone and then we will store this audio recording in users device. We will also play this saved audio recording. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language....