//网络视频
String videoUrl = "视频地址" ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri uri = Uri.parse( videoUrl);
videoView = (VideoView)mView.findViewById(R.id.videoView );
//设置视频路径
videoView.setVideoURI(uri);
//开始播放视频
videoView.start();
//视频进度控制器
videoView.setMediaController(new MediaController(this));
/**
* 循环播放
*/
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
mp.setLooping(true);
}
});
}