js extract image from mp4
<input type="file" id="upload"/>
<img id="thumbnail"/>
<script>
var input = document.getElementById('upload');
var img = document.getElementById('thumbnail');
input.addEventListener('change', function(event){
var file = this.files[0];
var url = URL.createObjectURL(file);
var video = document.createElement('video');
video.src = url;
var snapshot = function(){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
img.src = canvas.toDataURL('image/png');
video.removeEventListener('canplay', snapshot);
};
video.addEventListener('canplay', snapshot);
});
</script>
Also in JavaScript:
- /on in jquery
- js concat arrays with redeuce
- how to set background colour i js inline stylel
- javascript get index
- ngmodel div angular 7
- scoll a div to bottom in angular
- display json data in html table using javascript dynamically
- json datetime
- pdfjs customizing viewer.html js event handler
- lodash merge
- asp net core use newtonsoft json
- useHistory react-router-dom
- javascript includes
- abstraction in javascript
- how get parent element javascript
- javascript newline in alert
- read more css js
- Javascript get text input value
- how to move an ellipse along the x axis in javascript
- display none in jquery
- add firebase javascript
- read and save excel with react
- install node js 14
- react error boundary