I'm actually using a dynamically generated path based on what the OS says is 
the user's partition, so it's unlikely that the path is incorrect.
What i discovered is that the MediaPlayer refuses to play a file in a custom 
directory under the apps external directory, but will play it if I put it in 
the cache dir. The difference between he two is minimal. e.g.

This *will not* work:
<external>/Android/data/my.package.name/custom/audio

This *will* work:
<external>/Android/data/my.package.name/cache/audio

The only difference is the private directory (that is still world readable) at 
the same level in the same parent directory.

Personally I think limiting the audio source for the MediaPlayer like that is 
"broken" in the first place, but this seems to be an issue that doesn't match 
what the documentation says.

- Brill Pappin



On 2013-02-17, at 2:39 AM, Jeff Sharkey <[email protected]> wrote:

> Starting in Android 4.2, processes may have different views of the
> filesystem depending on which user they're running as.  For example,
> "/sdcard/foo.mp3" could refer to different files for different users.
> 
> To correctly disambiguate filesystem paths, you'll need to open the
> file in your app process and pass the FileDescriptor to the
> mediaserver (which is shared between all users on a device).
> Something like this should work:
> 
> MediaPlayer player;
> FileInputStream fis = new FileInputStream(myFile);
> try {
>    player.setDataSource(fis.getFD());
> } finally {
>    fis.close();
> }
> 
> It sounds like the setDataSource(String path) method needs to be
> fixed; tracking in 7962739.
> 
> j

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to