Olen
Olen

Reputation: 1185

Embedded Video - Iframe - YouTube - Won't autoplay

YouTube videos are being embedded at the top of single posts. However, the autoplay does not work.

The video is being embedded with Toolkit Types and I have set autoplay to on. This should work on both audio files and embedded media.

However, the autoplay does not work.

<div>
    <?php $renderfieldmedia = types_render_field('film', array('raw'=>'true'))?>
    <?php if(!empty($renderfieldmedia)){?>
        <div id="videoholder">
            <dd><?php echo(types_render_field('film', array("output" => "html", "autoplay" => "on"))); ?></dd>
        </div>
    <?php } elseif(empty($renderfieldmedia)){?>     
    <?php }?>               
</div>

I have tried the following:

  1. Checking for errors
  2. Deactivate almost all WordPress plugins
  3. Remove almost all JS

Still nothing.

If any help, the page can be found here

Upvotes: 0

Views: 184

Answers (1)

Priyanka Priyanka
Priyanka Priyanka

Reputation: 87

try this

<div>
<?php $renderfieldmedia = types_render_field('film', array('raw'=>'true'))?>
<?php if(!empty($renderfieldmedia)){?>
    <div id="videoholder">
        <dd><?php echo(types_render_field('film', array("output" => "html", "autoplay" => "1"))); ?></dd>
    </div>
<?php } elseif(empty($renderfieldmedia)){?>     
<?php }?>               

autoplay = 1

Visit https://developers.google.com/youtube/player_parameters#Manual_IFrame_Embeds

Upvotes: 1

Related Questions