For example: Section 1 HOME: has a video loop background, "video source 1" I want to change the video source by clicking on the video in section 1 to "video source 2",
but video2 has only to be played one time and has to switch back again to video1
How do I fix that
You can try something like this:
Create a Boolean for true/false as your "If played once" variable. Set it to = false;...
Give the (background) <video> tag an ID in the tag setup.
Add a "click" listener to the <video> tag.
The click handling function should get video object by ID...
Have an if statement to check If (played_Once == false)
Inside the if, you can set myVideoID.src = "other_video.mp4 and then do also:
myVideoID.load();
myVideoID.play();
played_Once = true;
You also need to add an "on ended" listener to the video object, where the handling function will change src in the same way as the steps above, back to the original video, remove the listener for "ended" at this point