Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery get duration video tag

$(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);
      });
    }
  });
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #duration #video #tag
ADD COMMENT
Topic
Name
3+6 =