MediaRecorder.OnInfo() never being called?

All your problems with Audio, Video and Images.

MediaRecorder.OnInfo() never being called?

Postby pnzrdrgoon » Tue Sep 07, 2010 5:45 pm

I'm trying to write an audio recorder and it's giving me problems. Here is a snippet of code I'm using:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  2. recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
  3. recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  4. recorder.setOutputFile(path);
  5. recorder.setMaxDuration(10000);  //ten seconds
  6. recorder.setOnInfoListener(new OnInfoListener(){
  8.                         @Override
  9.                         public void onInfo(MediaRecorder mr, int what, int extra) {
  10.                                 mr.stop();
  11.                                 mr.release();
  12.                         }});
  14. recorder.prepare();
  15. recorder.start();
Parsed in 0.041 seconds, using GeSHi

My problem is that at the end of the 10 seconds the OnInfoListener is never called even though it should be because the MaxDuration is supposed to call onInfo with a what of MEDIA_RECORDER_INFO_MAX_DURATION_REACHED as per ... ration(int)

What am I doing wrong?
Once Poster
Once Poster
Posts: 1
Joined: Tue Sep 07, 2010 5:31 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 10 guests