Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$(':file').change(function(){
var file = this.files[0];
var name = file.name;
var size = file.size;
var type = file.type;
console.log(name, size, type, file);
var myVideoPlayer = document.createElement('video');
myVideoPlayer.src = URL.createObjectURL(file);
myVideoPlayer.addEventListener('loadedmetadata', function() {
console.log(myVideoPlayer.duration);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment