Before I start, English isn't my first languages so sorry for any grammar and spelling errors.
Also, this may have been asked before. but I wasn't able to find it after a few days of searching.
I am trying to make a video playlist on my website
Currently, it grabs a large number of files from a folder and puts the first file as the source of the video. Then below the video, it echos all file names in a list item and gives them its number.
Screen shot of what i currently have
So what needs to be done?
If I load or refresh the page, I want the list to shuffle its order.
When a video ends the next video in the shuffled order starts playing.
I want to be able to select a song from anywhere in the list.
If the last song in the list ends start again from the first one.
How would I go about this since I am completely stuck
"I have no experience with js, so I haven't tried that."
The code that I currently have:
<?php
$files = glob('./vid/*.mp4'); // get all .mp4 files from folder
$fname = $files[0]; // get 1st filename
$ftext = ucwords(str_replace('_', ' ', basename($fname, '.mp4'))); // format text for display
?>
<video id="video" class="box" poster="poster.jpg" preload="metadata" controls>
<source src="<?php echo $fname; ?>"/>
</video>
<div id="infobox" class="box">Video: '<b><?php echo $ftext; ?></b>'</div>
<ul id="playlist" class="box">
<?php
$i = 1; // start track numbering from 1
foreach ($files as $file) {
$vid = ucwords(str_replace('_', ' ', basename($file, '.mp4'))); // format text for display
echo "<li><a href='#' data-video-src='$file'><b>$vid</b> <span>[$i / ".count($files)."]</span></a></li>\n";
$i++; // increment track number count
}
?>
</ul>