简体   繁体   English

全屏HTML5视频要大吗?

[英]Fullscreen HTML5 video to big?

I'm building a website with a fullscreen HTML5 video on the homepage. 我正在建立一个网站,主页上有全屏HTML5视频。

my HTML: 我的HTML:

<div class="fullscreen-bg">
    <div class="overlay-video"></div>
    <video loop muted autoplay poster="assets/images/background.jpg" class="fullscreen-bg__video">
        <source src="assets/video/background.webm" type="video/webm">
        <source src="assets/video/background.ogg" type="video/ogg">
        <source src="assets/video/background.mp4" type="video/mp4">
    </video>
</div>

and my CSS: 和我的CSS:

.fullscreen-bg {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    z-index: -100;
}
.fullscreen-bg__video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

My .webm file is 4,7mb, the .OGG file is 4,4mb and the .mp4 file is 37,1mb. 我的.webm文件是4,7mb,.OGG文件是4,4mb,.mp4文件是37.1mb。

My problem is that my website is still really slow. 我的问题是我的网站仍然很慢。 Are my video files to big? 我的视频文件很大吗? Or is there a problem with my tag and the way I load the videos? 还是我的标签和视频加载方式有问题?

I can not find any solutions for this on internet so I hope someone knows a solution. 我在互联网上找不到任何解决方案,因此希望有人知道解决方案。

Thanks! 谢谢!

Remove below mentioned line and video then test it. 删除下面提到的行和视频,然后对其进行测试。 If it is loading fast, then it is having issues with the size of .mp4 video. 如果加载速度很快,则说明.mp4视频的大小有问题。

    <source src="assets/video/background.mp4" type="video/mp4">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM