video preview javascript

Solutions on MaxInterview for video preview javascript by the best coders in the world

showing results for - "video preview javascript"
Vanessa
01 Jan 2020
1$(document).on("change",".file_multi_video",function(evt){
2  
3  var this_ = $(this).parent();
4  var dataid = $(this).attr('data-id');
5  var files = !!this.files ? this.files : [];
6  if (!files.length || !window.FileReader) return; 
7  
8  if (/^video/.test( files[0].type)){ // only video file
9    var reader = new FileReader(); // instance of the FileReader
10    reader.readAsDataURL(files[0]); // read the local file
11    reader.onloadend = function(){ // set video data as background of div
12          
13          var video = document.getElementById('video_here');
14          video.src = this.result;
15      }
16   }
17  
18});