【问题标题】:Linking to local video file for video background HTML/CSS链接到本地​​视频文件以获取视频背景 HTML/CSS
【发布时间】:2017-06-03 16:19:00
【问题描述】:

我一直试图在我的计算机上制作视频作为背景视频。我的视频标题为“runbg.avi”,它与我的 HTML 和 CSS 文件位于同一文件夹中。

这是我为寻找答案而访问的众多网站中的几个。

Using file:// instead of http:// when trying to get video from my computer rather than the web.

I can point to video on the web but not locally.

到目前为止我的程序。

/* BACKGROUND */
video#vid {
position: fixed; 
right: 0; 
bottom: 0;
min-width: 100%; 
min-height: 100%;
width: auto; 
height: auto; 
z-index: -100;
background-size: cover;
margin: 0 auto;
}
<!DOCTYPE html>
<head>
<title>Seb's Fitness</title>

<link rel = "stylesheet"
      type = "text/css"
      href = "css.css" />

      <video autoplay loop poster="" id="vid">
    <source src="file://runbg.avi" type="video/avi">
    </video>

【问题讨论】:

  • 这里有问题吗?
  • 如何链接到本地​​视频文件?
  • 你错过了 元素吗??

标签: html css video background html5-video


【解决方案1】:
<video autoplay loop poster="" id="vid">
    <source src="/runbg.avi" type="video/avi">
 </video>

/runbg.avi 表示从根文件夹(/)开始,然后搜索runbh.avi文件。

了解更多relative and absolute paths

【讨论】:

  • 如果这对您不起作用,则 html 和 .avi 文件不在同一个文件夹中。请让我知道您的文件夹结构以帮助您。
【解决方案2】:

编辑:HTML5 视频标签不支持 AVI 视频类型

您可以使用在线视频转换器工具转换为支持的视频类型。 MP4、OGG、WEBM

Does HTML5 <video> playback support the .avi format?

【讨论】:

  • link HTML5 视频标签不支持 AVI。必须使用 MP4、OGG 或 WEBM
  • 谢谢!我被难住了这么久。
猜你喜欢
  • 2015-01-10
  • 1970-01-01
  • 2016-05-17
  • 1970-01-01
  • 2016-02-05
  • 2020-10-18
  • 2012-09-20
  • 2016-10-24
  • 1970-01-01
相关资源
最近更新 更多