Pages

Get it free, Try now

Free Cell Phones

Friday, August 13, 2010

Recording with Android MediaRecorder API

MediaRecorder API, records in 3 file formats

1. 3gpp

2.AMR

3. Mp4

All there formats uses AMR encoder, code snippet given below recods for any audio source(as) such as:

MediaRecorder.AudioSource.DEFAULT,  MediaRecorder.AudioSource.VOICE_DOWNLINK,

MediaRecorder.AudioSource.VOICE_UPLINK, MediaRecorder.AudioSource.VOICE_CALL



mr = new MediaRecorder();
mr.setAudioSource(as); // as  = Audio Source
mr.setOutputFormat(ff); // ff = FileFormat
mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mr.setOutputFile(RECORDING_FILE); // filepath of the recording file
mr.prepare();
mr.start();




Note that, this API is compatible only with Android DONUT, does'nt work with Eclair and Froyo.

Tested and Verfied on LG GT 540 and guess to work with all devices based on this processor.















Microprocessor,-Chipset LG GT540 SWIFT (Optimus)


CPU:Clock:600 MHz
CPU: Qualcomm MSM7227
Browse devices based on this microprocessor

No comments:

Post a Comment