Skip to content Skip to sidebar Skip to footer

How To Create A Thumbnail Image From A Video In A Javascript Application

I want to create a thumbnail from a video so it can be uploaded alongside the video itself to a server. I have tried searching for js libs to do the work but cant seem to find any

Solution 1:

Using Canvas you can capture the video Thumb. here is the working example.

functionthumbnail(){
    var canvas = document.getElementById('canvas');
    var video = document.getElementById('video');
    canvas.getContext('2d').drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
}
document.getElementById('capture').addEventListener('click', function(){
	thumbnail();	
});
<buttonid="capture">
  capture
</button><canvasid="canvas"></canvas><videowidth="320"height="240"id="video"controls><sourcesrc=http://techslides.com/demos/sample-videos/small.ogvtype=video/ogg><sourcesrc=http://techslides.com/demos/sample-videos/small.mp4type=video/mp4>
Your browser does not support the video tag.
</video>

Post a Comment for "How To Create A Thumbnail Image From A Video In A Javascript Application"