Skip to content

Instantly share code, notes, and snippets.

@sanjogshrestha
Created December 19, 2017 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanjogshrestha/cc8c44b33255d0a527502080404048bd to your computer and use it in GitHub Desktop.
Save sanjogshrestha/cc8c44b33255d0a527502080404048bd to your computer and use it in GitHub Desktop.
Play video using MediaPlayer
private VideoView videoView;
videoView = (VideoView) findViewById(R.id.videoView);
Uri video = Uri.parse("http://www.servername.com/projects/projectname/videos/1361439400.mp4");
videoView.setVideoURI(video);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
videoView.start();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment