1
I made a page using the tag <video>
, as code below:
function teste(){
var url = document.getElementById('mudarVideo').value;
if(url === '')
{
alert('campo Vazio');
} else {
videoConteudo = document.getElementById('meuVideo');
videoConteudo.pause();
document.querySelector("#meuVideo > source").src = url;
videoConteudo.load();
}
}
<div class="center">
<input type="text" id="mudarVideo" value="">
<input type="button" id="btn-insere" onclick="teste()" value="Inserir novo video"/>
<video autoplay loop width="960" height="540" id="meuVideo">
<source src="http://www.jennylynpereira.com/demo/html/awesome-photography3/html/videos/video.mp4" id="tv_main_channel">
</video>
</div>
I wanted to do something interactive, so the user put a video url there on input
mudarVideo
(for example: techslides.com/demos/sample-videos/small.mp4), the site will be updated with the new content, this implementation was done in javascript and is working, but has no dynamic interaction.
To do this, I must create a database with a table that will receive the url (type VARCHAR
) and then store this url in the bank? Then just do a SELECT
of that url and add in place of the url, it is not?
document.querySelector("#meuVideo > source").src = url;