GianlucaGuarini/jquery.html5loader

onComplete is not working

Closed this issue · 4 comments

onComplete is not really working, I don't really know why. But please help? Thanks

Can you please verify it by enabling the 'debugMode' ?

I already enable debug mode, it all seems normal in console, from init, json loaded until percentage: 100%.

I'm trying to load video as a background, the video should not played until progress bar complete. But what I have here is more like, video loaded & played at the same time as progress bar started to move.

If you added the autoplay attribute in the video tag, remove it.
Or
Please refer line number : 325 $media.on("canplaythrough load",onMediaLoaded); in https://github.com/GianlucaGuarini/jQuery.html5loader/blob/master/js/jQuery.html5Loader.js , If the audio/video file is able to play without buffering/stopping (canplaythrough) , the file is considered as loaded. That might be reason for this issue.

Ciao @okhybonk the onComplete event is triggered before the preloader animation is completed because that's is how it should be.

The scripts inside the animations folder are just animation examples, they do not belong to jQuery.html5Loader itself.

Inside those scripts I need to use $.fn.animate that queues all the preloader percentage updates increasing it smoothly from 0 to 100% having a delay of 3000ms ( https://github.com/GianlucaGuarini/jQuery.html5loader/blob/master/js/animations/jQuery.html5Loader.circular.js#L182 ). This effect delays deliberately the end of the preloader animation. So the plugin callback onComplete doesn't mean that the preloader animation is completed!

For this reason I have updated the animation scripts so you can use a callback just when the animation is completed https://github.com/GianlucaGuarini/jQuery.html5loader/blob/master/examples/demo-big-counter.html#L78

I am going to close this bug