I made a page using the <video>
tag, as per the 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, as soon as the user places a url of the video there in 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, should I create a database with a table that will receive the url (type VARCHAR
) and then store that url in the database? Then just make a SELECT
of that url and add it to the url instead, is not it?
document.querySelector("#meuVideo > source").src = url;