// 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(); 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 spotifyBtn = $('spotifyBtn'); const controlsOverlay = $('controlsOverlay'); const controlsPanel = $('controlsPanel'); const closeCfg = $('closeCfg'); const spotifySearchBtn = $('spotifySearchBtn'); const spotifyOverlay = $('spotifyOverlay'); const spotifyModal = $('spotifyModal'); const closeSpotifyModal = $('closeSpotifyModal'); const spotifyQuery = $('spotifyQuery'); const spotifySearchSubmit = $('spotifySearchSubmit'); const spotifyOpenExternal = $('spotifyOpenExternal'); const spotifyFrame = $('spotifyFrame'); const spotifyFrameFallback = $('spotifyFrameFallback'); const spotifyStatePill = $('spotifyStatePill'); const videoSelect = $('videoSelect'); const audioSelect = $('audioSelect'); if (!videoEl) throw new Error("Falta