You can pass the path around all you want inside your app, but try using a FileDescriptor with MediaPlayer.setDataSource(). You won't have to change the permissions on the file that way (your app can still access the file however it wants, since it owns the file), but it will ensure there are no permissions problems when the file is played by the media server process, since you'll be handing it an open file handle.
On Mon, May 11, 2009 at 5:21 PM, Scott Slaugh <[email protected]> wrote: > > Nobody else uses the recording, but I do have several other functions > that use information that I can get from using a File object instead > of a FileDescriptor, such as file size. > > On May 11, 3:16 pm, Marco Nelissen <[email protected]> wrote: > > Does anyone else besides you need to be able to play back the recording? > > If not, try opening the file yourself and then passing its FileDescriptor > to > > setDataSource(), instead of specifying the path. > > > > On Mon, May 11, 2009 at 1:39 PM, Scott Slaugh <[email protected]> wrote: > > > > > I'm just using the built in MediaRecorder and MediaPlayer clases, so, > > > no I'm not using alsa_sound. > > > > > However, thanks to some help I was able to discover that the problem > > > is being caused by the permissions set on the recorded file, which is > > > not world-readable in Android 1.5. I was able to fix this by > > > inserting the following code: > > > > > //set player permissions > > > String command = "chmod 666 " + recordFile.toString(); > > > try { > > > Runtime.getRuntime().exec(command); > > > } catch (IOException e1) { > > > Log.e("SetPermissions", "Couldn't set permissions", e1); > > > } > > > > > If I execute that before creating the MediaPlayer, my code works > > > fine. But, does anyone know of a better way to set the permissions > > > correctly besides using the exec command? > > > > > Scott > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

