Last active
December 18, 2015 02:29
-
-
Save jrejaud/b5eb1b013c27a1f3ae5f to your computer and use it in GitHub Desktop.
Playing a video stored in your resources/raw directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VideoView myVideo = (VideoView) rootView.findViewById(R.id.definition_video_view); | |
//Set video name (no extension) | |
String myVideoName = "my_video"; | |
//Set app package | |
String myAppPackage = "com.myapp"; | |
//Get video URI from raw directory | |
Uri myVideoUri = Uri.parse("android.resource://"+myAppPackage+"/raw/"+myVideoName); | |
//Set the video URI | |
myVideo.setVideoURI(myVideoUri); | |
//Play the video | |
myVideo.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment