2017-02-21 65 views
0

我對響應式YouTube視頻有以下代碼,但它根本不顯示。當我刪除課程,視頻顯示,但其寬度非常短。 Here是託管它的網站。如在網站上顯示YouTube視頻在添加響應式課程後不顯示

<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> 
+0

需要包括重現您的問題,所以我們有一個[MCVE]請代碼。 –

+0

@MichaelCoker:添加了詳細信息。 –

+0

[將YouTube視頻縮小爲響應寬度](http://stackoverflow.com/questions/15844500/shrink-a-youtube-video-to-responsive-width) – pol

回答

2

YouTube網址是錯誤的。在URL中將v替換爲embed,並將&替換爲?以表示查詢字符串的開頭。

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

+0

將此代碼添加到網站上。在網站上不起作用。 –

+0

網址不是問題。嘗試在新標籤中打開它。 – pol

+0

@pol這是一個youtube iframe嵌入 - 必須使用'/ embed /'不要調用'/ v /'http://codepen.io/anon/pen/YNmoKg在瀏覽器選項卡上可以正常工作,但不能來自iframe。 –