添加自适应课程后,YouTube视频无法显示

时间:2017-02-21 23:12:29

标签: css twitter-bootstrap

我有以下代码用于响应式YouTube视频,但根本不显示。当我删除类时,视频显示但其宽度非常短。 Here是托管它的网站。

<div class="embed-responsive embed-responsive-16by9">
                <iframe class="embed-responsive-item" src="<?php echo get_field( "youtube_video" );?>" frameborder="0" allowfullscreen></iframe>
                <div class="more-videos">
                    <button type="button" class="btn btn-warning">View More Videos From Matt</button>
                </div>
</div>

网站上显示的HTML,

<div class="row">
            <div class="embed-responsive embed-responsive-16by9">
                <iframe class="embed-responsive-item" src="http://www.youtube.com/v/lQ2EZdkLCfc&version=3&loop=1&playlist=gq_zxxutiok,GEuouxgqa3Q,iwiXhnjlRuw" frameborder="0" allowfullscreen></iframe>
                <div class="more-videos">
                    <button type="button" class="btn btn-warning">View More Videos From Matt</button>
                </div>
            </div>
        </div>

1 个答案:

答案 0 :(得分:2)

Youtube网址错误。将v替换为网址中的embed,并将第一个&替换为?,以表示查询字符串的开头。

&#13;
&#13;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<div class="row">
  <div class="embed-responsive embed-responsive-16by9">
    <iframe class="embed-responsive-item" src="http://www.youtube.com/embed/lQ2EZdkLCfc?version=3&loop=1&playlist=gq_zxxutiok,GEuouxgqa3Q,iwiXhnjlRuw" frameborder="0" allowfullscreen></iframe>
    <div class="more-videos">
      <button type="button" class="btn btn-warning">View More Videos From Matt</button>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;