Video playing using Video View in android

纵然是瞬间 提交于 2019-12-12 03:49:12

问题


I have implemented a video player using video view. Default seek bar and buttons for control showing at bottom of screen. I want that it should be in video view itself. How can I achieve this. I am adding code also.

Code for Activity is:

 @Override
   public void onCreate(Bundle icicle) {
     super.onCreate(icicle);
     setContentView(R.layout.main);
     mVideoView = (VideoView) findViewById(R.id.surface_view);
     System.out.println(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.scotch_cppk));
     mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.scotch_cppk));
     mVideoView.setMediaController(new MediaController(this));
     mVideoView.start();

   }

main.xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"; android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> 
<VideoView android:id="@+id/surface_view" 
      android:layout_gravity="center" 
      android:layout_width="600dp" 
      android:layout_height="800dp"/> 
</LinearLayout> 

来源:https://stackoverflow.com/questions/15847922/video-playing-using-video-view-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!