+ 8
How do I check if my Audio/Video file is loaded or not?
I wanted to show a loading gif when my audio/video file is loading but I can't find a proper way to check if it is loaded or not. Any syntax in JavaScript to this problem?
1 Resposta
+ 1
video.addEventListener('progress', function() {
var loadedPercentage = this.buffered.end(0) / this.duration;
...
// suggestion: don't use this, use what's below
});
// Font: https://stackoverflow.com/questions/5029519/html5-video-percentage-loaded