W
W
Wasya UK2017-05-21 13:07:27
JavaScript
Wasya UK, 2017-05-21 13:07:27

How to get a preview (screensaver) of a video?

When the user uploads a video to input[type="file"] , at the end of the upload, the video file and buttons are displayed: upload, cancel. Is it possible to somehow pull out the splash screen image of the video file in order to place it in the display block of the video file. Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor L, 2017-05-21
@dmc1989

<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/*">

$(document).on("change", ".file_multi_video", function(evt) {
  var $source = $('#video_here');
  $source[0].src = URL.createObjectURL(this.files[0]);
  $source.parent()[0].load();
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question