39 lines
1.4 KiB
HTML
39 lines
1.4 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Studio (E2E)</title>
|
|
</head>
|
|
<body>
|
|
<div id="status">Esperando token...</div>
|
|
<script>
|
|
// simple receiver that mimics the App behaviour
|
|
window.addEventListener('message', (e) => {
|
|
try {
|
|
const data = e.data || {};
|
|
if (data && data.type === 'LIVEKIT_TOKEN' && data.token) {
|
|
// reply ack to sender
|
|
e.source && e.source.postMessage({ type: 'LIVEKIT_TOKEN_ACK', status: 'ok', room: data.room }, e.origin || '*');
|
|
// simulate connecting to LiveKit
|
|
setTimeout(() => {
|
|
document.getElementById('status').textContent = 'Conectado';
|
|
// send connected ack to opener/parent
|
|
if (window.opener && !window.opener.closed) {
|
|
window.opener.postMessage({ type: 'LIVEKIT_ACK', status: 'connected' }, e.origin || '*');
|
|
}
|
|
if (window.parent && window.parent !== window) {
|
|
window.parent.postMessage({ type: 'LIVEKIT_ACK', status: 'connected' }, e.origin || '*');
|
|
}
|
|
// also post to the source
|
|
e.source && e.source.postMessage({ type: 'LIVEKIT_ACK', status: 'connected' }, e.origin || '*');
|
|
}, 300);
|
|
}
|
|
} catch (err) { }
|
|
});
|
|
|
|
// expose a ready flag for tests
|
|
window.__studioReady = true;
|
|
</script>
|
|
</body>
|
|
</html>
|