简体   繁体   English

如何在不缓冲的情况下显示满载视频?

[英]How to display fully loaded video, without buffering?

Hi on my websitehttps://reportsquestionsznaczki65.000webhostapp.com/tech/o-nas/ I've tried plenty of things to make the video displaying AFTER it's fully loaded.嗨,在我的网站https://reportsquestionsznaczki65.000webhostapp.com/tech/o-nas/上,我已经尝试了很多方法来让视频在完全加载后显示。 I wanted to make the loading screen as long as the video is not buffered yet.只要视频尚未缓冲,我就想制作加载屏幕。 I've tried:我试过了:

[1] $("#video1").on("loadeddata",function(){
        $(".loader-wrapper").fadeOut("slow");
    });

[2] $(window).on("load",function(){
        $(".loader-wrapper").fadeOut("slow");
    });

None of them worked since both were loading the page when the frame loaded and then it started to buffer and it became a long time until it played (it's set to autoplay).它们都没有工作,因为它们都在加载框架时加载页面,然后它开始缓冲,直到它播放很长时间(它设置为自动播放)。

I would like to fade the loading effect when the video starts.我想在视频开始时淡化加载效果。 When the video is cached it works nice.当视频被缓存时,它工作得很好。 The strangest thing is on Edge since the video isn't displayed after loading, then it's displaying itself after 3 seconds (I delete my history and press ctrl + F5 to delete cache).最奇怪的是在 Edge 上,因为加载后视频不显示,然后在 3 秒后显示自己(我删除了我的历史记录并按 ctrl + F5 删除缓存)。

Is there any possibility to make it happen.有没有可能让它发生。 Maybe the size of the video is too large (7.93MB) to begin with?也许视频的大小太大(7.93MB)无法开始?

You need a way to tell whether the video has loaded or not, and if it has, then you can display it.您需要一种方法来判断视频是否已加载,如果已加载,则可以显示它。 Try this:尝试这个:

var video = document.getElementById("video-id-name");

if ( video.readyState === 4 ) {
    // loaded
}

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

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