diff --git a/mu-plugins/fea-audio-player.php b/mu-plugins/fea-audio-player.php index 9394070..1a6eb55 100644 --- a/mu-plugins/fea-audio-player.php +++ b/mu-plugins/fea-audio-player.php @@ -125,6 +125,18 @@ add_action('wp_footer', function () { document.querySelectorAll('audio[data-fea-audio-track]').forEach(function (audio) { var fired = false; audio.addEventListener('play', function () { + // La verificación pudo fallar en el primer intento (p.ej. audio.play() + // rechazado por política de autoplay tras el await de verificación) y + // dejar el mensaje de error en pantalla. Si el audio realmente rompe a + // reproducir -en este intento o en uno posterior desde los controles + // nativos-, ese es el estado real: limpiar el aviso y ocultar el botón. + var wrap = audio.closest('.fea-audio'); + if (wrap) { + var status = wrap.querySelector('.fea-audio-status'); + if (status) status.textContent = ''; + var button = wrap.querySelector('[data-fea-audio-verified-play]'); + if (button) button.hidden = true; + } if (fired || typeof gtag !== 'function') return; fired = true; gtag('event', 'audio_play', {