I have a folder containing multiple video files (all with an mp4 extension) that I want to play sequentially and then loop once it plays through all of the videos in the folder. The files do not need to be exposed to the internet so I'm not worried about security, but rather my videos are played through a localhost apache2 server. I don't want to have to do something like this:
<html>
<video autoplay>
<source src="video1.mp4" type="video/mp4">
<source src="video2.mp4" type="video/mp4">
...
<source src="videoN.mp4" type="video/mp4">
</video>
</html>
Because, I don't want to have to modify my index.php script every time I change the contents of my videos folder/directory, I am not looking for this. What I am looking for is something that is dynamic where the code is something more along the lines of:
1) Add all video files to a list
2) Iterate over each file in my list and then put as the video played by the video player.
3) Create a loop
The problem that I have found so far with looping and utilising PHP to echo HTML <video>
tags is that it ends up showing all of the videos, one underneath the other and plays them all at the same time (as a result of the autoplay in the <video>
tag). However, what I am wanting is for one video to play in the browser, then the next and so on...can anyone recommend the best way to do this please?