I've spent several hours trying to record audio on android-sdk-
windows-1.0_r1 and emulator, and surfing for information that would
tell me how to do it, or that it can't be done.  Posts like this one
suggest it can be done.  When I run the code in this post under the
Eclipse debuger and the emulator, I get a runtime exception:

   10-23 17:58:18.001: ERROR/AMS(196): java.lang.RuntimeException:
start failed.
   10-23 17:58:18.001: ERROR/AMS(196):     at
android.media.MediaRecorder.start(Native Method)

I have included the RECORD_AUDIO permission in the Androidmanifest.xml
file, as Lurky suggested on Oct.9

I've also found information that says one can not record audio using
the emulator.  For example on this page
   http://code.google.com/android/toolbox/apis/media.html page,
contains the following statement
  "While the emulator obviously doesn't have hardware to capture and
record audio and video ..."
While is statement is not true in the real world sense (for example my
laptop PC has a bulit-in microphone that many shareware applications
can use), perhaps the Android emulator is not able to use it?  Can
someone from Google confirm or deny this statement?

Sigh... I've also noted that the sample code from the web page whose
URL is above does not even compile in SDK v.1.  This is unfortunate,
given the scarcity of information about this promising platform.  If
anyone has a working example of recording audio (emulator or actual
device), please post it here!

For reference, my code (that get the ruintime exception shown above)
is:
        recorder = new MediaRecorder();
        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        recorder.setOutputFile("AudioOut.3gp");
        recorder.prepare();
        recorder.start();   // The runtime exception is throw here.
and my permission is:
        <uses-permission android:name="android.permission.RECORD_AUDIO"></
uses-permission>

Thanks in advance, Jim


On Oct 9, 11:15 pm, "[EMAIL PROTECTED]" <guang.zhou.
[EMAIL PROTECTED]> wrote:
> You may do the following two points before therecord.
>
> 1. set the permission for RECORD_AUDIO in Androidmanifest.xml.
> 2. simulate the sdcard.
>
> Theaudiofile should be stored in the sdcard.
>
> On Oct 9, 4:45 pm, Lurky <[EMAIL PROTECTED]> wrote:
>
> > Hi, All
> >     I needrecordvoice on the simulator and playback it. I wrot my
> > code according the example in the documents:
>
> > A common case of using MediaRecorder torecordaudioworks as
> > follows:
>
> > MediaRecorder recorder = new MediaRecorder();
> >  recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
> >  recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
> >  recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
> >  recorder.setOutputFile(PATH_NAME);
> >  recorder.prepare();
> >  recorder.start();   // Recording is now started
> >  ...
> >  recorder.stop();
> >  recorder.reset();   // You can reuse the object by going back to
> > setAudioSource() step
> >  recorder.release(); // Now the object cannot be reused
>
> >      My code created theaudiofile, but there isn't anyaudiodata in
> > it.
> >      Would you give me a completed demo code for how to use
> > MediaRecorder ?
>
> >     Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to