I'm searching for a way to play html5 video after its fully loaded. And while video is still loading - showing video placeholder image. Before i've used setTimeout function, but its not the way to accomplish this.
setTimeout(function() {
$('banner__video--fallback').fadeOut();
$('.banner__video')[0].play();
}, 800);
So what is the way around this to play video after its loaded?
EDITED: With solution 'canplaythrough' video still start ot be playing before its fully loaded.
$('.banner__video')[0].addEventListener("canplaythrough", function () {
$('banner__video--fallback').fadeOut();
$('.banner__video')[0].play();
}, false);