How To Send Video Thumbnail To Online Server
Hi am working on a video app in android i want to generate video thumbnail and send to the server or simple how can i get video thumbnail and store in server so that when i retriev
Solution 1:
I assume you are sending the video to the server also? If so then it may be better to generate the thumbnail on the server as you usually have more processing power there and less worry about consuming battery. It also saves you having to send the generated thumbnail to the server.
If you do want to create the thumbnail on the Android device then the following code will work (before this chunk the app has loaded all the videos in Media Store using the loader pattern and they are accessible via the 'cursor' variable below) - see the 'getThumbnail' method call:
while (videoCursor.moveToNext()) {
//Create the Thumbnail for this video
Log.d("ItemListFragment", "onLoadFinished: Creating Thumbnail");
StringvideoTitle= videoCursor.getString(titleColumn_index);
StringvideoPath= videoCursor.getString(pathColumn_index);
longvideoID= videoCursor.getLong(idColumn_index);
BitmapthisVideoThumbnail= MediaStore.Video.Thumbnails.getThumbnail(this.getActivity().getContentResolver(), videoID, MediaStore.Images.Thumbnails.MINI_KIND, null);
if (thisVideoThumbnail == null) {
Log.d("VideoContent refresh ","VideoThumbnail is null!!!");
}
VideoItemnewVideoItem=newVideoItem(videoID, videoTitle, videoPath, thisVideoThumbnail);
//Add the new video item to the list
videosArray.addItem(newVideoItem);
}
Post a Comment for "How To Send Video Thumbnail To Online Server"