commit 060207060075e3fa70a2fe38fd84abd69d0ffca9
parent f64d86c494609adb0b3774ecb1becf22d06dd501
Author: anon <anon@example.com>
Date: Sat, 17 Oct 2026 06:48:09 +0000
Preview captured frames inline and document reproduced turn corruption
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/browser/index.html b/src/browser/index.html
@@ -19,6 +19,11 @@
<button id="capture" disabled>Record frames</button>
<span id="capture-status"></span>
<a id="capture-download" hidden download="ao-frames.html">Download frame report</a>
+<div id="capture-viewer" hidden>
+<label>Captured frame <input id="capture-frame" type="range" min="0" value="0"></label>
+<span id="capture-label"></span><br>
+<img id="capture-image" alt="Captured game frame" style="max-width:100%">
+</div>
</details>
<pre id="log"></pre>
<script>
@@ -36,6 +41,14 @@
const captureStatus = document.querySelector('#capture-status');
const captureDownload = document.querySelector('#capture-download');
let recording = null, reportURL = null;
+ let capturedFrames = [];
+ const frameSlider = document.querySelector('#capture-frame');
+ function showCapturedFrame() {
+ const index = Number(frameSlider.value), frame = capturedFrames[index];
+ document.querySelector('#capture-image').src = frame.png;
+ document.querySelector('#capture-label').textContent = `${index + 1} / ${capturedFrames.length}`;
+ }
+ frameSlider.oninput = showCapturedFrame;
// Keep input times beside the frame sequence so turns can be replayed and inspected.
for (const type of ['keydown', 'keyup', 'mousedown', 'mouseup', 'mousemove']) {
@@ -52,6 +65,11 @@
captureStatus.textContent = `Saved ${report.frames.length} frames.`;
if (!report.frames.length) return;
report.log = log.textContent;
+ capturedFrames = report.frames;
+ frameSlider.max = capturedFrames.length - 1;
+ frameSlider.value = 0;
+ showCapturedFrame();
+ document.querySelector('#capture-viewer').hidden = false;
// A standalone HTML report retains every PNG and works without the game server.
const data = JSON.stringify(report).replaceAll('<', '\\u003c');
const viewer = `<!doctype html><meta charset="utf-8"><title>AO frame capture</title>
@@ -93,6 +111,9 @@ show();
if (!count.reportValidity()) return;
if (reportURL) URL.revokeObjectURL(reportURL);
captureDownload.hidden = true;
+ capturedFrames = [];
+ document.querySelector('#capture-viewer').hidden = true;
+ document.querySelector('#capture-image').removeAttribute('src');
recording = {requested: Number(count.value), started: new Date().toISOString(),
userAgent: navigator.userAgent, inputs: [], frames: []};
captureButton.textContent = 'Stop recording';