Multiple Videos | SoloLearn: Learn to code for FREE!

+1

Multiple Videos

let's say I have two or more videos on my page with HTML video tag, I found out that when I clicked both, both of them play... and I want a situation whereby only one video will play at a time, when one is clicked the other will stop... How can I use JavaScript for this? please help thanks

9/9/2018 8:36:38 PM

Adewale Olaoye

4 Answers

New Answer

+3

Video dom has play() and pause() methods.

+2

In additional to Toni Isotalo's answer: Have a look at this source👍: https://www.w3schools.com/tags/ref_av_dom.asp

0

thank you guys this helps but I've not gotten what I want... I want a situation that when I play one video, let's say out of 5 videos, only that one will play and if another video, say video4 is been clicked, video 1 will automatically pause without the user touching it...

0

gotcha!!! Now i get it, Thanks guys