Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have enabled the AutoPlay option on the VideoJS configuration page but it does not cause my video to play on page load. In fact it doesn't appear to actually cause any changes to the code output by this module. Is this option a future development or am I just using it incorrectly?
Thanks,
Jason
Comments
Comment #1
jasondecamp CreditAttribution: jasondecamp commentedAfter doing some digging in the module code and the theme template file, it appears that there is a settings array that is altered when the autoplay option is selected, but it doesn't appear to change anything on the HTML side, so I manually altered my videojs.tpl.php to include the following changes:
Line 4 now says -
<video id="<?php print $player_id; ?>-video" class="video-js" width="<?php print($width) ?>" height="<?php print($height) ?>" controls="controls" <?php print (variable_get('videojs_autoplay', 0) ? 'autoplay' : ''); ?> preload="auto" poster="<?php print($poster) ?>">
and Line 20 now says -
<param name="flashvars" value="config={'playlist': [ <?php if(isset($poster)) print("'".$poster."',"); ?> {'url': '<?php print($flash) ?>', <?php print (variable_get('videojs_autoplay', 0) ? "'autoplay':true" : "'autoplay':false"); ?>, 'autoBuffering':true} ]}" />
and Line 29 now says -
flashvars="config={'playlist': [ <?php if(isset($poster)) print("'".$poster."',"); ?> {'url': '<?php print($flash) ?>', <?php print (variable_get('videojs_autoplay', 0) ? "'autoplay':true" : "'autoplay':false"); ?>, 'autoBuffering':true} ]}"
I'm not too familiar with the language for flash embedding, but I think that change should get this configuration option up and running. At least it is working on my demo site using the HTML5 loader.
Comment #2
Jorrit CreditAttribution: Jorrit commentedFixed in 7.x-1.x.