summaryrefslogtreecommitdiff
path: root/stp-playback.html
blob: 452b1368ed5f66586a541c1866eba35bd1c0ad7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<html>
<!-- vim: set sts=2 sw=2 et : -->
<head>
  <script type="text/javascript">
    function video_ready() {
      var v = document.getElementById("rt-video");
      var buf = v.buffered;
      console.log ("N: " + buf.length + ", Start: " + buf.start(0) + ", End: " + buf.end(0));
      v.currentTime = buf.end(0);
      v.play();
    }

    function setup_video() {
      var v = document.getElementById("rt-video");
      console.log ("Setup video");
      v.addEventListener("loadeddata", video_ready, true);
      v.load();
    }

    window.onload = setup_video;
  </script>
</head>
<body>
  <video id="rt-video" preload="none" autoplay>
    <source src="http://localhost:8000/somepath" type="video/webm"/>
  </video>
</body>
</html>