// public/publish.js if (window.__PUBLISH_JS_RUNNING__) { console.warn('publish.js ya estaba corriendo, ignorando segunda carga.'); } else { window.__PUBLISH_JS_RUNNING__ = true; const rawOwnerId = new URLSearchParams(location.search).get('ownerId'); const ownerId = decodeURIComponent(String(rawOwnerId || '')).trim(); const pageParams = new URLSearchParams(location.search); const youtubeApiKey = String(pageParams.get('youtubeApiKey') || pageParams.get('ytKey') || pageParams.get('key') || '').trim(); if (!ownerId) throw new Error('ownerId requerido'); const MS = window.mediasoupClient; if (!MS?.Device) throw new Error('window.mediasoupClient.Device no existe. Revisa el bundle.'); const $ = (id) => document.getElementById(id); const overlay = $('overlay'); const videoEl = $('localVideo'); const micBtn = $('micBtn'); const camBtn = $('camBtn'); const configBtn = $('configBtn'); const controlsOverlay = $('controlsOverlay'); const controlsPanel = $('controlsPanel'); const closeCfg = $('closeCfg'); const videoSelect = $('videoSelect'); const audioSelect = $('audioSelect'); if (!videoEl) throw new Error("Falta