中
document.getElementById('enableAudioButton').addEventListener('click', () => {
const audioElement = document.getElementById('audio');
if (audioElement) {
audioElement.muted = false;
audioElement.play().then(() => {
console.log("enableAudioButton Audio is playing.");
}).catch((error) => {
console.error("enableAudioButton Error attempting to play audio:", error);
});
}
并按按钮“启用音频”,音频起作用。 我现在尝试做的是自动单击按钮,这是下一个挑战。