Youtube embed not working

牧云@^-^@ 提交于 2019-12-13 09:57:09

问题


Youtube embed code is not working, How can fix this?

https://fiddle.jshell.net/prabu0301/pLwz2bnx/3/


回答1:


It turns out you were using a wrong src for the <iframe>. You should use

https://www.youtube.com/embed/Foayrk4V5b4?&autoplay=1 

instead of

http://www.youtube.com/embed/Foayrk4V5b4?&autoplay=1

The https:// was the problem.

/* --- RESPONSIVE VIDEO --- */

.embed-container {
  position: relative;
  padding-bottom: 56.25%;
  /* 16/9 ratio */
  padding-top: 30px;
  /* IE6 workaround*/
  height: 0;
  overflow: hidden;
}

.embed-container iframe,
.embed-container object,
.embed-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}


/* --- This isn't needed, but helps demonstrate the "responsiveness" --- */

.wrapper {
  width: 90%;
  margin: 0 auto;
}
<div class="wrapper">
  <h1>Scale Me - Responsive Video</h1>

  <div class="embed-container">
    <iframe allowfullscreen="" frameborder="0" scrolling="no" src="https://www.youtube.com/embed/Foayrk4V5b4?&autoplay=1"></iframe>


  </div>

</div>


来源:https://stackoverflow.com/questions/48076049/youtube-embed-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!