summary:
- Add VideoView into the xml layout
- copy video into "res/raw" folder
- import android.widget.VideoView
- VideoView videoView;
- videoView = (VideoView)this.findViewById(R.id.videoView1);
- String path = "android.resource://" + this.getPackageName() + "/" + R.raw.render; // assume that the video is render.mp4
- alternatively: can use - String path = "android.resource://" + this.getPackageName() + "/raw/render"; // assume video is render.mp4
- can use http url to a video file online. but must add uses permission to Internet in Manifest.xml - <uses-permission android:name="android.permission.INTERNET"/>
- videoView.setVideoPath(path );
- videoView.start();
No comments:
Post a Comment