YouTube嵌入无法正常工作 [英] Youtube embed not working

查看:181
本文介绍了YouTube嵌入无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Youtube嵌入代码不起作用,该如何解决?

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

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

推荐答案

事实证明,您为<iframe>使用的是 错误 .您应该使用

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

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

代替

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

https://是问题所在.

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

这篇关于YouTube嵌入无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆