来自youtube的视频在iframe中不起作用 [英] Video from youtube in iframe doesn't work
本文介绍了来自youtube的视频在iframe中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在网站上放置视频。我将来自YouTube的视频链接放在我的网站上。我使用iframe。并没有看到任何视频。我只看到带有视频名称的屏幕,但看不到视频。我使用YouTube提供的链接。什么可能是一个问题?我应该在代码中使用更多东西吗?我必须添加一些元素来使用iframe吗?
I have to put video on website.I put video links from youtube on my website. I use iframe. And don't see any video. I see only screen with names of videos, but not a video.I use links which youtube gives. What can be a problem? Should I use something more in my code? I have to add something in meta to use 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 block
You have to go to youtube.com and click share then embed and copy the iframe source without doing it, it wont work as youtube as iframe block
.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>
这篇关于来自youtube的视频在iframe中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文