I am developing an android application for android OS > 4.0 (including and post OS). I have a sample m3u8 file as follows :
#EXTM3U
#EXT-X-TARGETDURATION:56
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:28, no desc
ulr/audio/file.mp3
#EXTINF:28, no desc
ulr/audio/file.mp3
#EXT-X-ENDLIST
and I am trying to play that file, using the following code
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnErrorListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try
{
mMediaPlayer.setDataSource(uri);
} catch (IllegalArgumentException e)
{
e.printStackTrace();
} catch (SecurityException e)
{
e.printStackTrace();
} catch (IllegalStateException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
mMediaPlayer.prepareAsync();
and my onPrepared()
method is as follows :
public void onPrepared(MediaPlayer player)
{
player.start();
}
But the code first comes to onPrepared()
and then immediately goes to onError()
, with the what=1
and the extra=-1010
.
I know this question has been asked various times (here, here and here for instance) and I also know about Vitamio, but i want to find out what is wrong with my implementation. Is there something wrong with the m3u8 file that I created? I went through its documentation and everything seems correct.
Would be really glad if someone could throw some light in this matter.