Right now, I've got a chunk of code that will load one of three videos -- The random play order is in the video itself.
In the code below, I'm dealing with only three videos, given all possibilities, that makes for around six possibilities when the page loads. I'll be dealing with around 12 videos on the final site and this method won't cut it given the time it would take to build each possibility (114 videos)...
Anyways, here's my code:
<div id="video_container">
<div id="video">
<video width="1060" height="596" autoplay="autoplay" loop="loop" muted="muted">
<? $videolink = get_template_directory_uri() . "/videos/";
$videos = array(
' <source src="' . $videolink . 'test-123.mp4" type="video/mp4">
<source src="' . $videolink . 'test-123.webm" type="video/webm">
<source src="' . $videolink . 'test-123.ogv" type="video/ogg">
',
' <source src="' . $videolink . 'test-132.mp4" type="video/mp4">
<source src="' . $videolink . 'test-132.webm" type="video/webm">
<source src="' . $videolink . 'test-132.ogv" type="video/ogg">
',
' <source src="' . $videolink . 'test-213.mp4" type="video/mp4">
<source src="' . $videolink . 'test-213.webm" type="video/webm">
<source src="' . $videolink . 'test-213.ogv" type="video/ogg">
',
' <source src="' . $videolink . 'test-231.mp4" type="video/mp4">
<source src="' . $videolink . 'test-231.webm" type="video/webm">
<source src="' . $videolink . 'test-231.ogv" type="video/ogg">
',
' <source src="' . $videolink . 'test-312.mp4" type="video/mp4">
<source src="' . $videolink . 'test-312.webm" type="video/webm">
<source src="' . $videolink . 'test-312.ogv" type="video/ogg">
',
' <source src="' . $videolink . 'test-321.mp4" type="video/mp4">
<source src="' . $videolink . 'test-321.webm" type="video/webm">
<source src="' . $videolink . 'test-321.ogv" type="video/ogg">
',
);
echo $videos[array_rand($videos)]; } ?>
</video>
</div>
</div>
It's pretty simple; a php array to build the list of options, then an echo to list one of the urls at random.
What I need to figure out is a way to autoplay one video, then randomly play another from a set directory as soon as it ends.
I thought that I might be able to put all of the videos into a slide show, but I'm not sure how the slider would be able to trigger each one to play when it shows...