4
01-15 00:57:08.660: WARN/System.err(25286): java.io.IOException: setDataSourceFD failed.: status=0x80000000
01-15 00:57:08.660: WARN/System.err(25286):     at android.media.MediaPlayer.setDataSource(Native Method)
01-15 00:57:08.660: WARN/System.err(25286):     at android.media.MediaPlayer.setDataSource(MediaPlayer.java:854)
...

...when trying to play local AMR audio file from application cache directory. It happens on HTC Magic, HTC Desire. AMR audio file is recorded by SonyEricsson xperia x10 mini and was downloaded from the Internet.

MediaPlayer is created in following way:

MediaPlayer player = new MediaPlayer();
player.setOnCompletionListener(this);
player.setOnErrorListener(this);
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
 FileInputStream fis = new FileInputStream(filePath);
 player.setDataSource(fis.getFD());
} catch (Exception e) {
 ...
}

Any ideas?

plugmind
  • 7,926
  • 4
  • 34
  • 39

1 Answers1

1

I've noticed that certain setDataSource calls can fail on different devices (probably due to idiosyncrasies in the platform specific player). For example, what fails using setDataSource( FileDescriptor ) may work fine with setDataSource( Context, Uri ) or setDataSource( String ).

Try using one of the others and see if that works.

EdChum
  • 376,765
  • 198
  • 813
  • 562
marwatk
  • 120
  • 5
  • I tried using setDataSource( String filePath ), but I use an audio file in application cache directory and MediaPlayer does not have access to it. However it works with FileDescriptor but not always. – plugmind Mar 25 '11 at 21:50