JSFiddle - React, Tailwind, and code Playground

by graphettion

HTML

<video id="myVideo" controls muted autoplay>
    <source src="https://download.blender.org/durian/trailer/sintel_trailer-480p.mp4" type="video/mp4">
  Your browser does not support the video tag.
  </video>

JavaScript

var v = document.getElementById("myVideo");

var buf = v.buffered;

var numRanges = buf.length;

console.log(buf)
console.log(numRanges)
console.log(v.duration)

if (buf.end === 52.209) {
	console.log("Buffer ended")
}

setInterval(() => {
	return v.duration
}, 1000)

if (buf.length == 1) {
  // only one range
  if (buf.start(0) == 0 && buf.end(0) == v.duration) {
    // The one range starts at the beginning and ends at
    // the end of the video, so the whole thing is loaded
  }
}