We hacked together a solution to autoplay a video programmatically, and have had to manually insert it into each new version of the plugin. So that we don't forget the steps, help others that need this functionality we post it here. Please consider adding this feature to the next release.
What it does:
Sometimes we do not want a video to autoplay, sometimes we do. This little hack will allow you to trigger an autoplay as needed.
In video-js.php, add the following:
- look for the /* The [video] shortcode */ section and after
$options = get_option('videojs_options'); //load the defaultsadd this line:
- scroll down to the // Autoplay the video? section and change
if ($autoplay == "true" || $autoplay == "on" )to
if ($autoplay == "true" || $autoplay == "on" || isset($wp_query->query_vars['autoplay']) )
To trigger an autoplay, simply add
$wp_query->set('autoplay', true); before the loop.
Test it, and if it works, drink a beer in celebration.