Android - how to set a thumbnail on a VideoView with a uri source?

android video view library
custom videoview android example
mediacontroller; videoview android example
videoview getcurrentposition
videoview autoplay android
fast-video view for android
load video in videoview android
set thumbnail for video view android

I need to get an image from a uri into my VideoView when it loads. It should disappear and start playing the video when play is hit. This is my VideoView code -





This is how I use it -

final VideoView video = (VideoView) convertView.findViewById(;

    Uri uri = Uri.parse(submission.getUrl());

    final ImageButton playButton = (ImageButton) convertView.findViewById(;
    video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        public void onCompletion(MediaPlayer mp) {
    playButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            if (video.isPlaying()){


VideoView shows a video. It does not show an image. Similarly, ImageView shows an image. It does not show a video.

So, use a FrameLayout wrapped around an ImageView and a VideoView. Have the ImageView be visible and the VideoView be invisible at the outset. Load the image into the ImageView. When the user clicks your play button, switch the visibility such that the VideoView is now visible and the ImageView is invisible, and start playback of your video.

How to set the preview image in videoview before playing, seekTo( 1 ) because setting . createVideoThumbnail("file path/url", MediaStore. android:focusable="true"> <VideoView android:id="@+id/video_view"  In this android programming source code example, we are going to create VideoView in Android. You can copy and adopt this source code example to your android project without reinventing the wheel. Below is a step by step source code to create VideoView in Android. activity_main.xml

Create a thumpnail of video and show it on ImageView. In case you need to show play button you need another ImageView (with Play button icon). On click of Play icon image view play the video on VideoView.


VideoView, Register a callback to be invoked when the media file is loaded and ready to go. void, setVideoPath(String path). Sets video path. void, setVideoURI(Uri  In this android programming source code example, we are going to create fullscreen VideoView in Android. You can copy and adopt this source code example to your android project without reinventing the wheel. Below is a step by step source code to create fullscreen VideoView in Android. activity_main.xml

I have created an ImageView for thumbnail like this

<RelativeLayout xmlns:android=""



And add setOnPreparedListener and setOnCompletionListener in Java like this way

  VideoView videoView = (VideoView) view.findViewById(;
  ImageView thumbnailView=(ImageView)view.findViewById(;

 //you can add progress dialog here until video is start playing;

    mediaController= new MediaController(getContext());
    videoView.start();         //call this method for auto playing video

    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        public void onPrepared(MediaPlayer mediaPlayer) {
 //you can Hide progress dialog here when video is start playing;

    videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        public void onCompletion(MediaPlayer mediaPlayer) {


It works for me very well. I hope it's useful for all.

VideoView Tutorial With Example In Android Studio, setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.​fishvideo));. Setting Video From Online Web Source: Step 1: First add internet  After that, we have set video resource to videoView. At last, we set click listener to button that play/pause video in videoView. If video is already playing, we pause the video. otherwise, we play the video when button is clicked. Method videoView.start() is being called to play the video. Method videoView.pause() is being called to pause the

Android Open Source - Camera-Example Main Activity, Android Open Source - Camera-Example Main Activity. Java Source Code ThumbnailUtils; import private Uri mediaUri; /** * @var private VideoView videoView * @brief The associated VideoView onCreate(​savedInstanceState); // set the orientation based on the layout int orientation = getResources(). VideoView Tutorial With Example In Android Studio. In Android, VideoView is used to display a video file. It can load images from various sources (such as content providers or resources) taking care of computing its measurement from the video so that it can be used for any layout manager, providing display options such as scaling and tinting.

How to set the preview image in videoview before playing , How to set the preview image in videoview before playing setAnchorView(​vvVideos); Uri video = Uri.parse("android.resource://" + BitmapDrawable bitmapDrawable = new BitmapDrawable(thumb); mVideoView. Android VideoView, Android VideoView example tutorial, Android VideoView from URL, Android VideoView custom MediaController, Android play video using VideoView class, Android Studio VideoView example app code.

Using VideoViews, The Hour21VideoView project contains this source code. In both cases, you can use the setVideoUri() method of VideoView. Uri class being defined from a String and the resulting Uri being set to the VideoView in line 3. In this tutorial, you will learn how to stream a remote video by using a MediaController and display it into a VideoView in your Android Application. MediaController is a controller for Media Player such as functions like Play/Pause, Rewind,

  • my question is probably a bit unclear.. I need for a way to extract an image out of the video itself.. not sure if this is possible.
  • @Suchi: If the video is known to MediaStore, it should have a thumbnail which you can retrieve, typically via an image-loading library (see this sample app). If the video is not known to MediaStore, ThumbnailUtils should be able to extract one, though I have not used it.