我有以下用于播放Uri视频的代码:
final MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri = Uri.parse("http://mirrors.standaloneinstaller.com/video-sample/star_trails.mp4");
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
progressDialog.setMessage("Loading video.....");
progressDialog.show();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
progressDialog.dismiss();
mediaController.show();
}
});
视频播放的前7秒,然后视频暂停。剩余的视频是缓冲的,当我寻找视频中的另一个点时,它将再播放几秒钟。