I have lots of videos in the directory “video” in my WordPress installation.
They all play nice using the MediaElement.js plugin, but is it also possible to play a random clip from this directory? For example using a shortcode that directs to the directory (and not to a specific video), something like
http://www.domain.com/wordpress/wp-content/video
That would be great!
This should be possible.
What you might want to do is use AJAX to generate the div containing your video player. If you do this, you can delete/recreate the player very easily.
After that what you’d need is a shortcode definition which feeds a directory string value and a boolean value into whichever function you attach to the shortcode handler.
For Instance
Also from http://php.net/manual/en/function.readdir.php