0
미디어 플레이어로 라이브 스트림 mp3 오디오를 재생하려고합니다. 문제는 URL을 사용할 때 UI 스레드가 언젠가 차단된다는 것입니다. 그러나 나는 그것이 버퍼링과 함께 곡을 연주 할 필요가있다.미디어 플레이어 버퍼로 노래 재생
감사합니다. 도움주세요.
try {
audioPlayer = new MediaPlayer();
audioPlayer.setOnBufferingUpdateListener(this);
audioPlayer.setOnCompletionListener(this);
audioPlayer.setAudioStreamType(useFrontSpeaker ? AudioManager.STREAM_VOICE_CALL : AudioManager.STREAM_MUSIC);
try {
audioPlayer.reset();
audioPlayer.setDataSource(mSongDetail.getPath());
audioPlayer.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
audioDuration = audioPlayer.getDuration();
audioPlayer.start();
startProgressTimer();
} catch (Exception e) {
if (audioPlayer != null) {
audioPlayer.reset();
audioPlayer.release();
audioPlayer = null;
isPaused = false;
MusicPreferance.playingSongDetail = null;
}
return false;
}
여기에 프로그램 관련 질문 게시 ... 일반적인 질문이 아닙니다 ... 코드 게시 ... 시도한 내용이 무엇입니까 ?? – Akshay
코드를 추가했습니다. – priyanka