系统自带视频
String uri = "android.resource://" + getActivity().getPackageName() + "/" + R.raw.xiaohuang;
//设置视频路径
videoView.setVideoURI(Uri.parse(uri));
// videoView.setVideoURI(Uri.parse(videoUrl1));
MediaController controller = new MediaController(getActivity());
videoView.setMediaController(controller);
controller.setAnchorView(videoView);
//开始播放视频
videoView.start();
<VideoView
android:id="@+id/videoView"
android:layout_width="300dp"
android:layout_height="match_parent"
/>