51 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Studio Panel - AvanzaCast</title>
</head>
<body>
<div id="root"></div>
<!-- Status element for E2E: presence ensures tests can detect ACK/state quickly -->
<div id="status" style="position:fixed;right:12px;top:12px;padding:8px 12px;background:rgba(0,0,0,0.05);color:#111;border-radius:6px;z-index:9999">Esperando token...</div>
<script>
// Ensure token present in querystring is delivered to the app via repeated postMessage
(function(){
try {
const params = new URLSearchParams(window.location.search);
const token = params.get('token');
const room = params.get('room') || '';
const username = params.get('username') || '';
if (token) {
const payload = { type: 'LIVEKIT_TOKEN', token: token, room: room, user: username };
const origin = window.location.origin || '*';
// send periodically for up to 8s to handle slow SPA mount
const interval = 500;
const maxMs = 8000;
let sent = 0;
const t0 = Date.now();
const id = setInterval(()=>{
try{
window.postMessage(payload, origin);
sent++;
// stop after maxMs
if (Date.now() - t0 > maxMs) {
clearInterval(id);
console.debug('[index] stopped repeated postMessage after', sent, 'attempts');
}
}catch(e){ console.debug('[index] repeated postMessage error', e); clearInterval(id); }
}, interval);
// also send once after 200ms immediately
setTimeout(()=>{
try{ window.postMessage(payload, origin); }catch(e){}
}, 200);
}
} catch (e) { /* ignore */ }
})();
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>