I'm still feeling directionless when it comes to what
MediaRecorder.setOutputFile(String path) is expecting.  Is it a
relative path?  Is it a fully qualified path?  Must the directory we
are recording in already exist, or will MediaRecorder create it for us
if it does not exist?  What happens if we specify a file path which
already exists - will it override the existing file or will it bomb
out?


On Mar 7, 10:30 pm, benmccann <benjamin.j.mcc...@gmail.com> wrote:
> jdl, I'd be happy to post my code, but I still don't have a working
> example.  I upgraded to the 1.1 SDK today in hopes that it fixed a bug
> and things would work for me, but it seems the media APIs are still
> hopelessly broken.  All I ever get is the meaningless message "start
> failed".  It looks like perhaps the cause is a buffer overflow in the
> native code:
>
> 03-07 21:19:42.059: DEBUG/AudioHardware(25): AudioStreamInGeneric::set
> (0xac50, 7, 1, 1, 8000)
> 03-07 21:19:42.069: DEBUG/AudioHardware(25): AudioStreamInGeneric::read
> (0x40308020, 320) from fd 7
> 03-07 21:19:42.078: DEBUG/AudioHardware(25): AudioStreamInGeneric::read
> (0x40308160, 320) from fd 7
> 03-07 21:19:42.078: DEBUG/AudioHardware(25): AudioStreamInGeneric::read
> (0x403082a0, 320) from fd 7
> 03-07 21:19:42.078: DEBUG/AudioHardware(25): AudioStreamInGeneric::read
> (0x403083e0, 320) from fd 7
> 03-07 21:19:42.088: WARN/AudioFlinger(25): AudioRecordThread: buffer
> overflow
> 03-07 21:19:42.098: DEBUG/AndroidRuntime(185): Shutting down VM
> 03-07 21:19:42.098: WARN/dalvikvm(185): threadid=3: thread exiting
> with uncaught exception (group=0x4000fe68)
> 03-07 21:19:42.098: ERROR/AndroidRuntime(185): Uncaught handler:
> thread main exiting due to uncaught exception
> 03-07 21:19:42.128: DEBUG/AudioHardware(25): AudioStreamInGeneric::read
> (0x40308020, 320) from fd 7
> 03-07 21:19:42.128: DEBUG/AudioHardware(25): AudioStreamInGeneric::read
> (0x40308160, 320) from fd 7
> 03-07 21:19:42.128: ERROR/AndroidRuntime(185):
> java.lang.RuntimeException: start failed.
> 03-07 21:19:42.128: ERROR/AndroidRuntime(185):     at
> android.media.MediaRecorder.start(Native Method)
> 03-07 21:19:42.128: ERROR/AndroidRuntime(185):     at
> com.benmccann.android.hello.AudioRecorder.start(AudioRecorder.java:59)
> 03-07 21:19:42.128: ERROR/AndroidRuntime(185):     at
> com.benmccann.android.hello.HelloAndroid$1.onClick(HelloAndroid.java:
> 31)
>
> On Mar 6, 1:38 pm, benmccann <benjamin.j.mcc...@gmail.com> wrote:
>
> > Bugs already 
> > exist:http://code.google.com/p/android/issues/detail?id=450&q=media%20docum......
>
> > On Mar 5, 9:23 pm, Dave Sparks <davidspa...@android.com> wrote:
>
> > > Log a bug athttp://b.android.com.
>
> > > On Mar 5, 2:17 pm, jdl <j...@edufone.com> wrote:
>
> > > > Diane or Dave,
>
> > > > How do we go about requesting that someone from the Android project
> > > > update the Audio/Video 
> > > > tutorial,http://developer.android.com/guide/topics/media/index.html,
> > > > so that it works with the current version of the API?
>
> > > > Thanks,
> > > > AN
>
> > > > On Feb 28, 2:45 pm, Dianne Hackborn <hack...@android.com> wrote:
>
> > > > > You use Context to get at your private data files:
>
> > > > >http://developer.android.com/guide/topics/data/data-storage.html
>
> > > > >http://developer.android.com/reference/android/content/Context.html#g...)
>
> > > > > On Thu, Feb 26, 2009 at 2:40 PM, benmccann 
> > > > > <benjamin.j.mcc...@gmail.com>wrote:
>
> > > > > > >> each application has its own private data directory /
> > > > > > >> data/app-private/app-package. I believe your working directory 
> > > > > > >> is set
> > > > > > >> to this directory by default
>
> > > > > > Cool.  So it sounds like I should just be able to use a relative 
> > > > > > path
> > > > > > from the current location then.  Unfortunately, I'm getting the
> > > > > > following exception (with no clues as to why start is failing):
>
> > > > > > 02-26 14:34:55.132: ERROR/AndroidRuntime(164):
> > > > > > java.lang.RuntimeException: start failed.
> > > > > > 02-26 14:34:55.132: ERROR/AndroidRuntime(164):     at
> > > > > > android.media.MediaRecorder.start(Native Method)
>
> > > > > > Here's my code:
>
> > > > > >    final MediaRecorder recorder = new MediaRecorder();
> > > > > >    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
> > > > > >    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
> > > > > >    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
> > > > > >    recorder.setOutputFile("test.3gpp");
> > > > > >    recorder.prepare();
> > > > > >    recorder.start();
>
> > > > > > On Feb 26, 12:14 am, Dave Sparks <davidspa...@android.com> wrote:
> > > > > > > You can get the path to external storage (e.g. SD card) with
> > > > > > > Environment.getExternalStorageDirectory(). This is world read/
> > > > > > > writable.
>
> > > > > > > Alternatively, each application has its own private data 
> > > > > > > directory /
> > > > > > > data/app-private/app-package. I believe your working directory is 
> > > > > > > set
> > > > > > > to this directory by default. This is onboard flash, so it will
> > > > > > > survive the user ejecting an SD card. However, there is a limited
> > > > > > > amount to go around, so you don't want to store monster media 
> > > > > > > files
> > > > > > > there.
>
> > > > > > > On Feb 25, 9:22 pm, benmccann <benjamin.j.mcc...@gmail.com> wrote:
>
> > > > > > > > >> setOutputFile() expects a path to where you want the file 
> > > > > > > > >> stored.
>
> > > > > > > > Yep, figured that much by the method name, but what's a valid 
> > > > > > > > path?  I
> > > > > > > > mean I'm figuring it's UNIX-like, but other than that I'm in the
> > > > > > > > dark.  Is there a preferred place for apps to store data?  Are 
> > > > > > > > there
> > > > > > > > certain directories that I have permission to write to?  What
> > > > > > > > directories exist on the device by default?  It'd be nice for 
> > > > > > > > the docs
> > > > > > > > on data storage to mention any of these things:
> > > > > >http://developer.android.com/guide/topics/data/data-storage.html
>
> > > > > > > > >> You can take a look at the source to SoundRecorder in the 
> > > > > > > > >> open
> > > > > > source tree for some working code
>
> > > > > > > > Thanks for the example.  This would be a much better example 
> > > > > > > > than the
> > > > > > > > one in the docs that won't compile and implies content must 
> > > > > > > > first be
> > > > > > > > added to a database:
> > > > > >http://developer.android.com/guide/topics/media/index.html
>
> > > > > > > > On Feb 24, 8:03 pm, Dave Sparks <davidspa...@android.com> wrote:
>
> > > > > > > > > setOutputFile() expects a path to where you want the file 
> > > > > > > > > stored.
>
> > > > > > > > > You can take a look at the source to SoundRecorder in the 
> > > > > > > > > open source
> > > > > > > > > tree for some working code:
>
> > > > > >http://android.git.kernel.org/?p=platform/packages/apps/SoundRecorder...
>
> > > > > > > > > On Feb 24, 4:43 pm, benmccann <benjamin.j.mcc...@gmail.com> 
> > > > > > > > > wrote:
>
> > > > > > > > > > Hi,
> > > > > > > > > > I'd like to create anaudiorecordingin Android.  (Actually, 
> > > > > > > > > > I just
> > > > > > > > > > want access to the mic withoutrecordingit, but it seems 
> > > > > > > > > > that's not
> > > > > > > > > > supported so I'll have to create arecordingand tail the 
> > > > > > > > > > file).
> > > > > > > > > > I'm having a very hard time getting started.  Mostly I'm 
> > > > > > > > > > just
> > > > > > hoping
> > > > > > > > > > that someone from Google reads this and will update the
> > > > > > documentation
> > > > > > > > > > because the example won't compile - it looks like it's from 
> > > > > > > > > > some
> > > > > > > > > > previous version of the SDK because there's an error in 
> > > > > > > > > > every other
> > > > > > > > > > line.  I made my best guess as to what the usage should be, 
> > > > > > > > > > but I
> > > > > > keep
> > > > > > > > > > getting a number of different exceptions.
> > > > > > > > > > One question I had is whether I can just specify an 
> > > > > > > > > > arbitrary path
> > > > > > to
> > > > > > > > > > the MediaRecorder to startrecordingor whether I have to 
> > > > > > > > > > create an
> > > > > > > > > > entry in the content database.  The JavaDoc for
> > > > > > > > > > MediaRecorder.setOutputFile isn't clear on what it's 
> > > > > > > > > > expecting.
>
> > > > > > > > > > Thanks,
> > > > > > > > > > Ben
>
> > > > > --
> > > > > Dianne Hackborn
> > > > > Android framework engineer
> > > > > hack...@android.com
>
> > > > > Note: please don't send private questions to me, as I don't have time 
> > > > > to
> > > > > provide private support.  All such questions should be posted on 
> > > > > public
> > > > > forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to