Play Next Youtube Src When The Other One Is Finished
So basically i got an unlimited number of different types of divs with lists in them and they all include an a tag with a youtube video... When i press on it gets played on a big i
Solution 1:
You need to use the youtube iframe api to be able to access the player events and be able to execute code when a video ends. Check this answer for more details.
The rest is just plain js/jquery for keeping track of which video is playing and telling the player to load that video. I created an example of it here: https://codepen.io/ahmed-wagdi/pen/xdWvBL
Basically you keep track of the current video using a current_video
variable. When a link is clicked you set that variable to the index of the clicked element, when the video ends you just increment it. Just make sure to handle the cases where you're playing the last video, i didnt do that in my example
Post a Comment for "Play Next Youtube Src When The Other One Is Finished"