diff --git a/logs/server.log b/logs/server.log index df137f3..1dc406c 100644 Binary files a/logs/server.log and b/logs/server.log differ diff --git a/static/tts.html b/static/tts.html index f79d6d0..fdf2012 100644 --- a/static/tts.html +++ b/static/tts.html @@ -545,25 +545,6 @@ let currentVoice = 'zh-CN-XiaoxiaoNeural'; let autoPlay = true; // 自动播放开关 let volumeLevel = 1.5; // 音量倍率 - let audioUnlocked = false; // 音频播放是否解锁 - - // 解锁音频播放(浏览器需要用户交互后才能自动播放) - function unlockAudio() { - if (!audioUnlocked) { - // 创建一个静音音频来解锁 - const silentAudio = new Audio(); - silentAudio.play().then(() => { - audioUnlocked = true; - console.log('音频播放已解锁'); - }).catch(e => { - console.log('音频解锁失败:', e); - }); - } - } - - // 页面点击解锁音频 - document.addEventListener('click', unlockAudio, { once: true }); - document.addEventListener('touchstart', unlockAudio, { once: true }); // 元素 const statusDot = document.getElementById('statusDot'); @@ -947,9 +928,6 @@ const audio = new Audio(url); const icon = btn.querySelector('.play-icon'); - // 应用音量倍率 - audio.volume = Math.min(volumeLevel, 2); // 最大不超过2 - audio.onplay = () => { icon.textContent = '🔊'; btn.classList.add('playing'); @@ -960,21 +938,7 @@ btn.classList.remove('playing'); }; - audio.onerror = (e) => { - console.error('音频播放失败:', url, e); - icon.textContent = '❌'; - btn.classList.remove('playing'); - }; - - // 添加播放失败的catch - audio.play().catch(e => { - console.error('播放被阻止:', e); - icon.textContent = '🔇'; - // 提示用户点击播放 - if (e.name === 'NotAllowedError') { - showError('请先点击页面解锁音频播放'); - } - }); + audio.play(); } // 显示加载