tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

1897631.html (1278B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <head>
      4 <title>Bug 1897631</title>
      5 </head>
      6 <body>
      7 <script>
      8 function createFrame(width, height, timestamp) {
      9  let duration = 33333; // 30fps
     10  let cnv = new OffscreenCanvas(width, height);
     11  let ctx = cnv.getContext("2d");
     12  ctx.fillStyle = "#FF0000";
     13  ctx.fillRect(0, 0, width, height);
     14  return new VideoFrame(cnv, { timestamp, duration });
     15 }
     16 
     17 async function boom() {
     18  const decoder = new VideoDecoder({
     19    output: (frame) => { frame.close(); },
     20    error: (e) => {},
     21  });
     22 
     23  const encoder = new VideoEncoder({
     24    output: (chunk, metadata) => {
     25      if (metadata.decoderConfig) {
     26        decoder.configure(metadata.decoderConfig);
     27      }
     28      decoder.decode(chunk);
     29    },
     30    error: (e) => {}
     31  });
     32 
     33  encoder.configure({
     34    codec: "vp8",
     35    width: 640,
     36    height: 480,
     37    displayWidth: 640,
     38    displayHeight: 480,
     39  });
     40 
     41  // Refresh the page after a delay of 10 milliseconds
     42  setTimeout(() => {
     43    window.onload = null;
     44    location.reload();
     45    document.documentElement.removeAttribute("class");
     46  }, 10);
     47 
     48  function keepEncoding() {
     49    setTimeout(() => {
     50      encoder.encode(createFrame(640, 480, 0));
     51      keepEncoding();
     52    }, 0);
     53  }
     54 
     55  keepEncoding();
     56 }
     57 
     58 window.onload = boom;
     59 </script>
     60 </body>
     61 </html>