• 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.

    The Hack:
    In video-js.php, add the following:

    1. look for the /* The [video] shortcode */ section and after
      $options = get_option('videojs_options'); //load the defaults add this line:
      global $wp_query;
    2. 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']) )

    The Trigger
    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.

    http://wordpress.org/extend/plugins/videojs-html5-video-player-for-wordpress/

  • The topic ‘[Plugin: VideoJS – HTML5 Video Player for WordPress] Autoplay Video Programmatically’ is closed to new replies.