tags:

views:

37

answers:

4

Hi all! When i record my audio from MIC and store file in /data/data/..... why MediaPlayer can't play this file ? If i change destination to / sdcard/..... - all works great. I do something wrong ? I not found limitation for MediaPlayer. Device - Samsung T959 (Galaxy S) Thanks, i hope anybody know solution....

A: 

Try setting ContentValues and to store some standard meta-data properties. Then using a ContentResolver to set the meta-data and Uri to the file.

see: http://developer.android.com/guide/topics/media/index.html

"Example: Audio Capture Setup and Start", then try changing Uri base to your /data/data/-filename.

MatteKarla
Thank you for your reply, but changing Uri base not working :( Illegal argument exception appers when inserts to base
dmtrlbdv
A: 

Thank you for your reply, but changing Uri base not working :( Illegal argument exception appers when inserts to base

dmtrlbdv
A: 

Due to the Android security model, MediaPlayer haven't enough rights. It can access SD card, but can't access another places with out permissions.

As so, setDataSource(...) can thrown SecurityException and I think it's happening.

You can play this file next ways:

  • copy it to temp dir and play;
  • copy it to temp dir and play;
  • copy it to sdcard;
  • read it fully to memory and try play via stream.
dive
A: 

use MediaPlayer.setDataSource(FileDescriptor fd)

n_j
no, it not helps me :(
dmtrlbdv