I am trying to display thumbnail of a video but I am not able to generate the thumbnail for the video.
My activity_main contains
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/Thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
My Main Activity has the following code
package com.example.video1;
import android.app.Activity;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.os.Bundle;
import android.provider.MediaStore.Video.Thumbnails;
import android.widget.ImageView;
public class MainActivity extends Activity {
String filePath = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView thumbnail_mini = (ImageView) findViewById(R.id.Thumbnail);
Bitmap bmThumbnail = ThumbnailUtils.createVideoThumbnail(filePath,
Thumbnails.MINI_KIND);
thumbnail_mini.setImageBitmap(bmThumbnail);
}
}
Its displaying nothing . How can I display the thumbnail of video?