$(document).ready(function() {
var data = $('#file-input')[0]; // File from <input type="file"> tag
var reader = new FileReader();
reader.addEventListener('load', function() {
var video = $('<video class="uploaded_video_src" controls></video>');
if (reader.result) {
$('.uploaded_video_src').append(`<source src="${reader.result}" type="video/mp4">`); // Add type attr for support for some .mov files
video.on('loadedmetadata', function() {
console.log('duration:', $(this)[0].duration);
});
}
});
});