// Carrega áudio autenticado e converte para blob URL async function loadAuthAudio(audioEl, path) { if (!path || path === 'null' || path === 'undefined') return; const token = localStorage.getItem('ep_token'); if (!token) return; try { const url = '/api/recordings/audio/' + path; const r = await fetch(url, { headers: { Authorization: 'Bearer ' + token } }); if (!r.ok) { console.error('Audio fetch failed:', r.status, url); return; } const blob = await r.blob(); audioEl.src = URL.createObjectURL(blob); } catch(e) { console.error('Audio load error:', e); } } // Inicializa todos os audio elements com data-auth-src async function initAuthAudios() { const els = document.querySelectorAll('audio[data-auth-src]'); for (const el of els) { await loadAuthAudio(el, el.dataset.authSrc); } }