android media player - PVMFFailure on mp3 http radio stream
I want to play mp3 radio stream using Android MediaPlayer via http protocol. From time to time [1 playing of 5 - that is actually quite often] I receive PVMFFailure like this:
02-23 02:05:23.503: ERROR/PlayerDriv开发者_JS百科er(91): Command PLAYER_INIT completed with an error or info PVMFFailure
02-23 02:05:23.503: ERROR/MediaPlayer(2111): error (1, -1)
02-23 02:05:23.533: ERROR/MediaPlayer(2111): stop called in state 0
02-23 02:05:23.533: ERROR/MediaPlayer(2111): error (-38, 0)
There is no solution here or on google, so please if you do know how to debug this, please help :)
Here is my code for player:
//start
MediaPlayer player = new MediaPlayer();
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.setDataSource(address);
player.prepare();
player.start();
//stop
player.stop();
player.reset();
I`m using Android 2.2 API. Thanks!
You should use player.prepareAsync();
instead player.prepare();
.
精彩评论