Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d25a8d2e5 |
@@ -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', {
|
||||
|
||||
Reference in New Issue
Block a user