Android 애플리케이션으로 스트리밍하려는 mp3 파일 모음이있는 보관 용 미디어 서버가 있습니다.
"MediaPlayer"를 사용하는 것이 API를 사용하는 가장 좋은 방법이라는 것을 알고 있습니다.
내 주요 관심사는 음악이 차례로 재생되는 프로세스를 어떻게 자동화하는 것입니까? 마치 인터넷 라디오 앱처럼?
누군가 가이드의 올바른 위치를 알려주거나 예제 코드를 표시해 주시면 미리 감사드립니다.
음악 파일 이름을 배열 목록 (예 : 노래)에 배치 한 다음 onCompletionListener를 구현 한 다음 미디어 플레이어에 설정합니다. 리스너 내부에서 미디어 플레이어를 다시 시작하여 다음 항목을 재생합니다.
myMediaPlayer.setOnCompletionListener(this);
public void onCompletion(MediaPlayer arg0) {
arg0.release();
if (counter < songs.size()) {
counter++;
arg0 = MediaPlayer.create(getApplicationContext(), songs.get(counter);
arg0.setOnCompletionListener(this);
arg0.start();
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다