75.2 Recording Audio and Video using the MediaRecorder Class
As with audio playback, recording can be performed using a number of different techniques. One option is to use the MediaRecorder class, which, as with the MediaPlayer class, provides a number of methods that are used to record audio:
•setAudioSource() – Specifies the source of the audio to be recorded (typically this will be MediaRecorder.AudioSource.MIC for the device microphone).
•setVideoSource() – Specifies the source of the video to be recorded (for example MediaRecorder.VideoSource.CAMERA).
•setOutputFormat() – Specifies the format into which the recorded audio or video is to be stored (for example MediaRecorder.OutputFormat.AAC_ADTS).
•setAudioEncoder() – Specifies the audio encoder to be used for the recorded audio (for example MediaRecorder.AudioEncoder.AAC).
•setOutputFile() – Configures the path to the file into which the recorded...