Wie kann ich einstellen, dass die Vorschau der video-Datei, die Auswahl von input type='file'

In einem meiner module, die ich brauche zu durchsuchen Videos von input[type='file'], nach, dass ich brauche, um zu zeigen, ausgewählte Videos vor dem Start upload.

Ich bin mit grundlegenden HTML-Tags zu zeigen. aber es funktioniert nicht.

Hier ist der code:

JS:

$(document).on("change",".file_multi_video",function(evt){
  
  var this_ = $(this).parent();
  var dataid = $(this).attr('data-id');
  var files = !!this.files ? this.files : [];
  if (!files.length || !window.FileReader) return; 
  
  if (/^video/.test( files[0].type)){ //only video file
    var reader = new FileReader(); //instance of the FileReader
    reader.readAsDataURL(files[0]); //read the local file
    reader.onloadend = function(){ //set video data as background of div
          
          var video = document.getElementById('video_here');
          video.src = this.result;
      }
   }
  
});

HTML:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<video width="400" controls >
              <source src="mov_bbb.mp4" id="video_here">
            Your browser does not support HTML5 video.
          </video>


 <input type="file" name="file[]" class="file_multi_video" accept="video/*">

InformationsquelleAutor Ronak Patel | 2016-03-16
Schreibe einen Kommentar