Note that there are some explanatory texts on larger screens.

plurals
  1. POMediaPlayer.setDataSource causes IOException for valid file
    primarykey
    data
    text
    <p>This code used to work. Then, maybe I changed something, somewhere (or if I know Android right, an update introduced a bug in the media player). It stopped working on <em>some</em> devices! Especially my Nexus S (2.3.6).</p> <p>The file <code>test.m4a</code> (17 775 201 bytes) was downloaded by the app. To verify its integrity, I copied it to the SD and played it on my PC. No problem! Also binary-compared it with the original file, and it matched 100%.</p> <pre><code>try { _mediaPlayer = new MediaPlayer(); _mediaPlayer.setOnCompletionListener(this); _mediaPlayer.setOnPreparedListener(this); _mediaPlayer.setOnSeekCompleteListener(this); _mediaPlayer.setOnBufferingUpdateListener(this); _mediaPlayer.setOnInfoListener(this); _mediaPlayer.setOnErrorListener(this); // I even tried reading the file from SD card. Same error... File file = new File("/data/data/com.mycompany.myapp/files/MediaCache/Test.m4a"); // file.isFile() == true // file.length() == expected value! FileInputStream is = new FileInputStream(file); _mediaPlayer.setDataSource(is.getFD()); // Throws! // If I use the filename as parameter, it throws later when preparing the media player... _mediaPlayer.prepareAsync(); } catch (Exception e) { // java.io.IOException: setDataSourceFD failed.: status=0x80000000 e.printStackTrace(); } </code></pre> <p><strong>Q:</strong> What might cause this <code>IOException</code> for <code>setDataSourceFD</code> when the file is indeed valid?</p> <p><strong>UPDATE: Here's a 98 kB audio file that I cannot play on my Nexus S (2.3.6):</strong> <a href="http://www.2shared.com/audio/wUKoRiQk/test.html" rel="noreferrer">http://www.2shared.com/audio/wUKoRiQk/test.html</a></p> <p>A friend of mine runs some ZTE device (2.2) and it seems to work. I don't get it!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload