1
In my application the user can select a video to add to the form, but before sending it I would like it to display the video when the user selects the file. I managed to do this already with images using Filereader in Javascript. With video does not work, I tried it but without result.
Just follow my code:
function exibirVideoPc() {
document.getElementById("vid").onchange = function(event) {
var file = event.target.file;
var blobURL = URL.createObjectURL(file);
document.querySelector("video").src = blobURL;
}
}
THE HTML:
<div class="form-group">
<input type="file" class="form-control-file" id="vid" name="vid" accept="video/*" onchange="exibirVideoPc();" required>
<div class="invalid-feedback">Campo Obrigatório.</div>
</div>
<div id="embed-video" style="text-align:center;">
<video width="480" controls>
<source src="" id="video_here">
Seu navegador não suporta vídeo HTML5.
</video>
</div>
Very good @Sam ! That’s right, thank you!
– SanOli