Here is the simple and useful tutorials for using multimedia data in android.
Performing Audio Capture
Audio capture from the device is a bit more complicated than audio and video playback, but still fairly simple:
- Create a new instance of
android.media.MediaRecorder
. - Set the audio source using
MediaRecorder.setAudioSource()
. You will probably want to useMediaRecorder.AudioSource.MIC
. - Set output file format using
MediaRecorder.setOutputFormat()
. - Set output file name using
MediaRecorder.setOutputFile()
. - Set the audio encoder using
MediaRecorder.setAudioEncoder()
. - Call
MediaRecorder.prepare()
on the MediaRecorder instance. - To start audio capture, call
MediaRecorder.start()
. - To stop audio capture, call
MediaRecorder.stop()
. - When you are done with the MediaRecorder instance, call
MediaRecorder.release()
on it. CallingMediaRecorder.release()
is always recommended to free the resource immediately.
Record a Video with a Camera App
The Android way of delegating actions to other applications is to invoke an
Intent
that describes what you want done. This process involves three pieces: The Intent
itself, a call to start the external Activity
, and some code to handle the video when focus returns to your activity.Take a Photo with the Camera App
The Android way of delegating actions to other applications is to invoke an
Intent
that describes what you want done. This process involves three pieces: The Intent
itself, a call to start the external Activity
, and some code to handle the image data when focus returns to your activity.Here is the output snaps of this app:
Download Full Source Code