public class MainActivity extends Activity {
private VideoView video;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
video = (VideoView) findViewById(R.id.videos);
}
public void plays(View v) {
// 视屏的路径
video.setVideoPath("/sdcard/oppo.mp4");
// 显示出控制版面
MediaController controller = new MediaController(this);
controller.setVisibility(View.VISIBLE);
// 控制器
video.setMediaController(controller);
video.start();
}
}
视频播放
最新推荐文章于 2024-01-15 21:15:00 发布