How to add mp4 file to application? Here I have 20 seconds, video instruction for the user, how to play it in the application? So that the user presses the "start" button and the screen opens and the video plays there?
- onetried to VideoView? - Android Android
|
1 answer
VideoView helped me in my case.
1) Install the VideoView element in the XML file
2)
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video); VideoView videoView = (VideoView) findViewById(R.id.videoView); // Здесь нужно указать путь к своему файлу String videoSource = "android.resource://com.example.aleksey.firstwizard/" + R.raw.anim; videoView.setVideoURI(Uri.parse(videoSource)); videoView.setMediaController(new MediaController(this)); videoView.requestFocus(); videoView.start(); } And it all worked
|