3
My home page has a video as background but in some moments the video takes to be loaded. In this situation I thought of creating a loading
before the page is displayed, my doubt is how can I check with the jquery/javascript
if a file (video) has already been loaded completely to then display the entire page.
Video is a local archive
<video id="video" autoplay loop muted>
<source src="/public/video/capa_video.mp4" type="video/mp4">
</video>
On my page I am using the plugin fullpage js
, then in my file .js
I already have the function ready
of jquery
.
$(document).ready(function() { ... });
How can I display a load effect before the entire document is loaded (images, videos, fonts, etc) ?
You can’t with the event
window.onload
?– Woss
@Andersoncarloswoss sometimes the page is loaded but the video has not yet been fully loaded, so it hangs somewhere.
– RFL
Maybe I can get you help!
– Marconi
From what he said, the event
onload
can be fired before the video is fully loaded (maybe it would be because the video is not downloaded at once and yes streamed?)– Woss
Put a div covering the content and an animated gif of loading and use window.onload to hide that div when the page is loaded completely. (See Marconi’s link in the comment above that leads up to Jbueno’s answer in another question).
– Antonio Alexandre
Put the code next to the question and specify the environment better. The video displayed is local or Youtube/etc?
– Woss
@Andersoncarloswoss improved the question
– RFL