• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html xmlns="http://www.w3.org/1999/xhtml">
2
3  <head>
4    <title>Massive Memory Leak</title>
5    <script>
6      <![CDATA[
7
8        function loadVideo (videoURI) {
9          var xhr = new XMLHttpRequest();
10          xhr.open('GET', videoURI, true);
11          xhr.onreadystatechange = function (xhrEvent) {
12            if (xhr.readyState == 3) {
13              var currentLength = xhr.responseText.length;
14              var totalLength = parseInt(xhr.getResponseHeader('Content-Length'), 10);
15              print((Math.round((currentLength / totalLength) * 10000) / 100) + '%');
16            }
17            else if (xhr.readyState == 4) {
18              if (xhr.status == 200) {
19                alert('done loading');
20                alert(xhr.responseText.length);
21              }
22              else {
23                alert('NOK');
24              }
25            }
26          };
27          xhr.send(null);
28        }
29
30        function print (message) {
31          document.getElementById('outlet').textContent = message;
32        }
33
34      ]]>
35    </script>
36  </head>
37
38  <body>
39    <a onclick="loadVideo('http://streamos.atlrec.com/download/atlantic/bjork/video/bjork_itunes1.m4v');">do it!</a>
40    <p id="outlet" />
41  </body>
42
43</html>
44