来自youtube的视频在iframe中不起作用
问题描述:
我必须在网站上放置视频。我把来自YouTube的视频链接放在我的网站上。我使用iframe。并没有看到任何视频。我只看到带有视频名称的屏幕,但看不到视频。我使用YouTube提供的链接。什么可能是一个问题?我应该在代码中使用更多东西吗?我必须添加一些元素来使用iframe?来自youtube的视频在iframe中不起作用
.central-container{
margin-left: 18.75%;
margin-right: 18.75%;
height: 100%;
}
.container-for-all-videos{
width: 100%;
height: 100%;
margin-top: 30px;
}
.container-for-video{
margin: 10px;
width: 46%;
min-width: 250px;
}
.container-for-video h4{
margin-top: 10px;
text-align: center;
}
@media (min-width: 978px){
.container-for-video:nth-child(odd){
float: left;
}
.container-for-video:nth-child(even){
float: right;
}
}
@media (min-width: 440px){
.bottom-info-container{
margin: 50px auto 150px auto;
}
}
@media (max-width: 978px){
.container-for-video{
margin-left: auto;
margin-right: auto;
}
}
<div class="central-container">
<div class="container-for-all-videos">
<div class="container-for-video">
<iframe src="https://www.youtube.com/watch?v=_N1z37KqpCc" width="100%" height="auto" frameborder="0" allowfullscreen>
</iframe>
<h4>ד"ר אלדר על ניתוחים בריאטריים</h4>
</div>
<div class="container-for-video">
<iframe src="https://www.youtube.com/watch?v=rAwB17JTIgs" width="100%" height="auto" frameborder="0" allowfullscreen>
</iframe>
<h4>ד"ר אלדר מתארח אצל אלונה פרידמן על ניתוחים בריאטריים</h4>
</div>
<div class="container-for-video">
<iframe src="https://www.youtube.com/watch?v=PMHpU-f3Kzo" width="100%" height="auto" frameborder="0" allowfullscreen>
</iframe>
<h4>ניתוח שרוול קיבה ע"י ד"ר אלדר</h4>
</div>
<div class="container-for-video">
<iframe src="https://www.youtube.com/watch?v=0ij0poiNEvw" width="100%" height="auto" frameborder="0" allowfullscreen>
</iframe>
<h4>ראיון נוסף של ד"ר אלדר אצל אלונה פרידמן</h4>
</div>
<div class="container-for-video">
<iframe src="https://www.youtube.com/watch?v=rfF-1tyG_uI&t=21s" width="100%" height="auto" frameborder="0" allowfullscreen>
</iframe>
<h4>ד"ר אלדר על תוצאות ארוכות טווח של ניתוחים בריאטריים</h4>
</div>
<div class="container-for-video">
<iframe src="https://www.youtube.com/watch?v=_N1z37KqpCc" width="100%" height="auto" frameborder="0" allowfullscreen>
</iframe>
<h4>ד"ר אלדר על ניתוחים בריאטריים</h4>
</div>
</div>
答
你必须去youtube.com和点击份额,然后嵌入和复制的iframe源没有这样做,它不会因为YouTube的合作作为IFRAME块
.central-container{
margin-left: 18.75%;
margin-right: 18.75%;
height: 100%;
}
.container-for-all-videos{
width: 100%;
height: 100%;
margin-top: 30px;
}
.container-for-video{
margin: 10px;
width: 46%;
min-width: 250px;
}
.container-for-video h4{
margin-top: 10px;
text-align: center;
}
@media (min-width: 978px){
.container-for-video:nth-child(odd){
float: left;
}
.container-for-video:nth-child(even){
float: right;
}
}
@media (min-width: 440px){
.bottom-info-container{
margin: 50px auto 150px auto;
}
}
@media (max-width: 978px){
.container-for-video{
margin-left: auto;
margin-right: auto;
}
}
<div class="central-container">
<div class="container-for-all-videos">
<div class="container-for-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/rAwB17JTIgs" frameborder="0" allowfullscreen></iframe>
<h4>ד"ר אלדר על ניתוחים בריאטריים</h4>
</div>
<div class="container-for-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/rAwB17JTIgs" frameborder="0" allowfullscreen></iframe>
<h4>ד"ר אלדר מתארח אצל אלונה פרידמן על ניתוחים בריאטריים</h4>
</div>
<div class="container-for-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/rAwB17JTIgs" frameborder="0" allowfullscreen></iframe>
<h4>ניתוח שרוול קיבה ע"י ד"ר אלדר</h4>
</div>
<div class="container-for-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/rAwB17JTIgs" frameborder="0" allowfullscreen></iframe>
<h4>ראיון נוסף של ד"ר אלדר אצל אלונה פרידמן</h4>
</div>
<div class="container-for-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/rAwB17JTIgs" frameborder="0" allowfullscreen></iframe>
<h4>ד"ר אלדר על תוצאות ארוכות טווח של ניתוחים בריאטריים</h4>
</div>
<div class="container-for-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/rAwB17JTIgs" frameborder="0" allowfullscreen></iframe>
<h4>ד"ר אלדר על ניתוחים בריאטריים</h4>
</div>
</div>
你如何打电话给你的网站?用'http://'或'https://'? – reporter
我仍然没有把它放在服务器上。所以,它没有http://或https://。但对于视频,我尝试了他们两个。 – Natalia