1

My code is

    // preload video
    // see http://stackoverflow.com/questions/16581801/force-a-full-preload-html5-video-with-javascript
    var source = document.createElement('source');
    source.src = src;
    source.type = type;
    this.videlem.appendChild(source);
    progressHandler = function (e) {
        if (this.videlem.duration) {
            var percent = (this.videlem.buffered.end(0) / this.videlem.duration) * 100;
            console.log(percent.toFixed(2) + "%");
            if (percent >= 100) {
                console.log("loaded!");
            }
            this.videlem.currentTime++;
        }
    }
    this.videlem.addEventListener("progress", progressHandler.bind(this), false);

(Yes, on my dev team we always comment out when we ripped something off of StackOverflow)

where this.videlem is the empty video element

<video preload="auto" muted poster="assets/somepic.png" id="ssvid"></video>

and src and type are valid. The problem is that it's always getting stopped loading somewhere around the beginning. See screenshot of console below.

Any idea what I'm doing wrong here?

enter image description here

Subpar Web Dev
  • 3,210
  • 7
  • 21
  • 35
  • This answer might be helpful: http://stackoverflow.com/questions/9616236/html5-video-full-preload-in-javascript/23299806#23299806 – ninapavlich May 13 '16 at 21:16

0 Answers0