Pick random file from directory with given extensions
<?php
//http://stackoverflow.com/questions/4478783/select-random-file-from-directory
function random_video($dirName = "files/videos/")
{
$files = array_merge(glob($dirName . "*.m4v"), glob($dirName . "*.mp4"), glob($dirName . "*.mov"));
$file = array_rand($files);
return $files[$file];
}
?>
<a href="<?php echo random_video(); ?>">Video</a>