首页 > 解决方案 > iframe 不显示 youtube

问题描述

我已经搜索了几天嵌入视频的问题,但找不到该问题的正确解决方案。

我正在使用 Linux 上的 FF 在 localhost 上编辑购买的 web html5 模板。

的HTML

 <!-- blog side -->
<section class="blog-side sp-seven blog-style-one standard-post video-post">
    <div class="container">
        <div class="row">
            <div class="col-md-9 col-sm-12 col-xs-12 content-side">
                <div class="blog-details-content">
                    <div class="wrapper">
                        <div class="videowrapper">
                        <iframe src="https://www.youtube-nocookie.com/embed/NNcvbxIODsY?start=15" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                        </div>
                    </div>                        

CSS

  .blog-side {
  position: relative;
}

.wrapper {
  margin: 0 auto;

} 
.videowrapper {
  position: relative;
  padding-bottom: 56.25%;
  padding-top: 25px;
  height: 0px;
}

.videowrapper iframe {
  position: absolute;
  left: 0px;
  top: 0px;
  right: 0px;
  bottom: 0px;
  height: 100%;
  width: 100%;
}

视频不显示,但收到此错误代码 -未找到文件

这怎么可能

我从 YT 获得的嵌入代码很长,并且有许多我不感兴趣的属性,并删除了其中一些结果相同的属性。

这可能是一个 .js 问题吗?

标签: html5-videoembedyoutube-iframe-api

解决方案


你的 html 文件是怎么命名的?我认为您没有正确定位您的 html 文件(其中包含 iframe 和其余代码)


我这样说是因为您的屏幕截图显示名为的文件<iframe width=...不存在

你的路径应该是这样的:

/home/esmeralda/Desktop/Belfast/myFile.html

在这里,myFile.html是包含源代码“iframe、css 样式等”的文件(扩展名为 .html) 。


推荐阅读