MediaPlayer make 1 lag after start
I create MediaPlayer object for playing a stream audio, from http url source. Every time when object starts to play audio after 3-4 seconds audio has stopped, buffering and play again, but only 1 time. Than all is good
Code :
String url = "http://icecast.vgtrk.cdnvideo.ru/vestifm_mp3_192kbps";
audioPlayer = new MediaPlayer();
audioPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});
try {
//setProgressBarPlayer(Constants.ACTION_BUFFERING);
audioPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
audioPlayer.setDataSource(url);
audioPlayer.prepareAsync();
audioPlayer.setWakeMode(ctx, PowerManager.PARTIAL_WAKE_LOCK);
} catch (IOException e) {
e.printStackTrace();
}
my LogCat is showed below
上一篇: 直播从网络摄像头或频道的Android
下一篇: MediaPlayer在启动后有1次滞后