(() => { const INTERVAL_MS = 5 * 60 * 1000; const ENDPOINT = '/api/session/keepalive'; async function keepSessionAlive() { try { await fetch(ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}', credentials: 'same-origin', cache: 'no-store', }); } catch (error) { // A failed keepalive should not interrupt editing or playback. } } keepSessionAlive(); window.setInterval(keepSessionAlive, INTERVAL_MS); })();