import asyncio, sys, json, time from playwright.async_api import async_playwright BASE = "http://localhost:5173/preview/production/1b822e06-b78d-4352-884d-1f8fddabf546/" async def main(): async with async_playwright() as p: b = await p.chromium.launch(args=["--autoplay-policy=no-user-gesture-required"]) pg = await b.new_page(viewport={"width": 1400, "height": 900}) errs = [] pg.on("pageerror", lambda e: errs.append("PAGEERROR " + str(e))) pg.on("console", lambda m: errs.append(m.type + ": " + m.text) if m.type in ("error", "warning") else None) await pg.goto(BASE) await pg.wait_for_timeout(5000) txt = await pg.evaluate("document.body.innerText.slice(0, 600)") print(txt) # audio segment test r = await pg.evaluate("""async () => { const m = await import('./src/video/audio.ts'); const t0 = performance.now(); await m.loadVoices(); const t1 = performance.now(); const out = {}; for (const k of [0, 7, 9, 13]) { const s = performance.now(); const b = await m.renderSegment(k, true); const d = b.getChannelData(0); let sum = 0, peak = 0; for (let i = 0; i < d.length; i++) { sum += d[i]*d[i]; peak = Math.max(peak, Math.abs(d[i])); } out[k] = { ms: Math.round(performance.now() - s), len: b.length, rms: Math.sqrt(sum / d.length).toFixed(4), peak: peak.toFixed(3) }; } const nb = await m.renderSegment(9, false); const d2 = nb.getChannelData(0); let s2=0; for (let i=0;i