Skip to content

Instantly share code, notes, and snippets.

@jrejaud
Last active December 18, 2015 02:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrejaud/b5eb1b013c27a1f3ae5f to your computer and use it in GitHub Desktop.
Save jrejaud/b5eb1b013c27a1f3ae5f to your computer and use it in GitHub Desktop.
Playing a video stored in your resources/raw directory
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