1

I am trying to get the video to show how much has loaded with the code below but its not working at least not how I expect it to sometimes it shows the progress loaded but the majority of the time it does not. I have checked the console but no errors occur.

Does anybody know what I am doing wrong or if there is a better way for me to do this?

var video = document.getElementById("video");
video.addEventListener('progress', function() {
console.log(video.buffered.length);
if(video.buffered.length > 0){
    var loadedPercentage = this.buffered.end(0) / this.duration;
    }
});
    <div id="video_container"> 
        <video id="video" controls width="80%" > 
            <source src="<? echo $src; ?>"> 
            <track label="English" kind="subtitles" srclang="en" src="<? echo $subLink; ?>" default>
        </video> 
    </div>  
  • Buffering is not necessarily from beginning to current, it could consist of several segments depending on how the browser chose to load. See if something in this answer can help out: https://stackoverflow.com/questions/18422517/html5-video-buffered-attribute-features/18624833#18624833 –  Apr 11 '16 at 06:50
  • Nope that question stems from something he created himself he doesnt use the controls built in i do i need something to manipulate the built in controls –  Apr 11 '16 at 16:10

0 Answers0