I want to run all the videos that are in the folder, autoplay them and repeat them continuously.
I have found some javascript code and it works perfectly but it has to be included in the javascript code list, is there a way to change this coding to read all the videos in a folder.
this is the javascript code :
<div class="main">
<video src="video\\video1.mp4" id="myvideo" width="100%" height="100%" controls autoplay poster="gambar\logo.png">
</video>
<script>
var myvid = document.getElementById('myvideo');
var myvids = [
"video\\video1.mp4",
"video\\video2.mp4",
"video\\video3.mp4"
];
var activeVideo = 0;
myvid.addEventListener('ended', function(e) {
// update the new active video index
activeVideo = (++activeVideo) % myvids.length;
// update the video source and play
myvid.src = myvids[activeVideo];
myvid.play();
});
</script>
</div>
if indeed there is another way I will also accept it, maybe using a database to read the file or other coding. Please help.