bạn có thể nghe từ VideoView.
VideoView mVideoView=new VideoView();
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer pMp) {
//use a global variable to get the object
}
});
Hoặc nếu bạn chỉ quan tâm đến sự kiện Trình phát phương tiện, bạn có thể sử dụng bất kỳ điều này và chúng được triển khai trên VideoView và đây là những sự kiện cơ bản của MediaPlayer.
void setOnCompletionListener(MediaPlayer.OnCompletionListener l)
void setOnErrorListener(MediaPlayer.OnErrorListener l)
void setOnInfoListener(MediaPlayer.OnInfoListener l)
void setOnPreparedListener(MediaPlayer.OnPreparedListener l)
Tất cả các chức năng này cũng sẽ cung cấp cho trường hợp Trình phát Media.
Bạn có thể làm điều đó thông qua [phản ánh] (http://tutorials.jenkov.com/java-reflection/private-fields-and-methods.html). – yorkw
phản ánh quá lộn xộn và quá nguy hiểm. có thể mở rộng videoView và nhận mediaPlayer ở đó không? –