Đang xem các bài viết theo từ khóa

Tổng biên tập Hoàng Thị Huệ chia sẻ trước ngày kỷ niệm 30 năm Thành lập Tạp chí Biển Việt Nam

document.addEventListener("DOMContentLoaded", function () { const audio = document.getElementById("articleAudio"); const button = document.getElementById("mobileAudioButton"); if (!audio || !button) { return; } button.addEventListener("click", function () { if (audio.paused) { audio.play().then(function () { button.classList.add("playing"); button.querySelector("span").textContent = "⏸️"; button.setAttribute( "aria-label", "Tạm dừng audio" ); }).catch(function (error) { console.log("Không thể phát audio:", error); }); } else { audio.pause(); button.classList.remove("playing"); button.querySelector("span").textContent = "🔊"; button.setAttribute( "aria-label", "Phát audio" ); } }); /* Khi audio phát hết */ audio.addEventListener("ended", function () { button.classList.remove("playing"); button.querySelector("span").textContent = "🔊"; button.setAttribute( "aria-label", "Phát audio" ); }); });