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(){
  7.  
  8.                         @Override
  9.                         public void onInfo(MediaRecorder mr, int what, int extra) {
  10.                                 mr.stop();
  11.                                 mr.release();
  12.                         }});
  13.    
  14. recorder.prepare();
  15. recorder.start();
  16.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


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 http://developer.android.com/reference/ ... ration(int)

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

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 6 guests