Play different videos on a div without reloading the page

0

I need some help, I would like from the same page to play several videos, I explain better in a div put a player and next to several buttons that every time you click on the button loads me the video of that button on the div without having to reload the page, the links of the videos would be stored in a database, I do not know where to start, in advance thanks.

    
asked by Stivents 16.10.2017 в 04:57
source

1 answer

2

Try to do this

Time I am changing the video locally with iframe from youtube, but in your case you can make the call with the data you have in your mysql

function cambiar() { 
var urlvideo ="https://www.youtube.com/embed/QFfKEJcDO-8";
document.getElementById('video').src=urlvideo; 

} 
<div style='float:left;'>
<iframe width="560" height="315" src="https://www.youtube.com/embed/wnJ6LuUFpMo" frameborder="0" allowfullscreen id='video'></iframe>

</div>
<button type='button' onclick='cambiar()'>SIGUIENTE VIDEO</button>

I hope it works for you, best regards

    
answered by 16.10.2017 / 06:18
source