Can't get the setOnInfoListener() event while recording.

All your problems with Audio, Video and Images.

Can't get the setOnInfoListener() event while recording.

Postby frog0322 » Thu Dec 24, 2009 9:42 am

Hello, everyone. I'm Frocs.
I think that get the many infomations in here. So very thanks.

I'm making a voice recorder. [SDK 1.6]
It is limited the maxium file size.[Max: 300*1024]
And I want to get the event when it is reached the maxium size.
So. I set the setMaxFileSize(Max) and setOnInfoListener(this) in MediaRecorder.

When the MediaRecorder is reached max. size,
Recorder is stop but don't get the MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED.

Plz, help me..
Thanks for your help.

----------------------------------- My code -----------------------------------------------------------
public class AndirodTest extends Activity implements OnClickListener, OnInfoListener {
/** Called when the activity is first created. */
private MediaRecorder mr;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button bu1 = (Button)findViewById(R.id.Button01);

bu1.setOnClickListener(this);
}

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.v("FROCS", "Start Recording");
File file = new File(Environment.getExternalStorageDirectory(), "test.amr");
mr = new MediaRecorder();
mr.setAudioSource(MediaRecorder.AudioSource.MIC);
mr.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mr.setMaxFileSize((long)(300*1024));
mr.setOutputFile(file.getAbsolutePath());
mr.setOnInfoListener(this);

try {
mr.prepare();
} catch(IOException exception) {
mr.reset();
mr.release();
mr = null;
return;
}
mr.start();
}

@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
// TODO Auto-generated method stub
Log.v("FROCS", "called onInfo() ");
mr.reset();
mr.release();
mr = null;
}

}

--------------------------------------------------------------------------------------------------------------
frog0322
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Dec 03, 2009 5:29 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 7 guests