【问题标题】:Remove black background from html5 video. Appears for a second从 html5 视频中删除黑色背景。出现一秒
【发布时间】:2014-07-31 12:50:03
【问题描述】:

如何从 html5 视频中去除黑色背景?加载时它会出现几秒钟。使用 CSS 不起作用。

HTML:

<div id="start-screen">
  <video id="video-element">
    <source src="video-mp4.mp4" type="video/mp4">
    <source src="video-oggtheora.ogv" type="video/ogg">
  </video> 
</div>

CSS(不工作):

#start-screen, video-element {
  background-color: #fff !important;
}

谢谢!

【问题讨论】:

    标签: css html video html5-video


    【解决方案1】:

    我没有找到使用 CSS 的有效解决方案。但我发现使用非常小的白色(或您想要的任何颜色)海报图像就可以了。所以如果你有同样的问题,我就是这样做的。我刚刚使用了一个 100x100px 的 PNG 文件(大小约为 1KB)。

    <div id="start-screen">
      <video id="video-element" poster="/images/white-poster-image.png">
        <source src="video-mp4.mp4" type="video/mp4">
        <source src="video-oggtheora.ogv" type="video/ogg">
      </video> 
    </div>
    

    玩得开心!

    【讨论】:

    • 这只是我在 IE 中的一个问题。不幸的是,这在 IE11 中不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    • 2014-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多