diff --git a/src/main.js b/src/main.js index 44706aa..04f9775 100644 --- a/src/main.js +++ b/src/main.js @@ -299,7 +299,8 @@ class AudioPlayer { this.connectAudioSource(); // 等待音频数据加载完成后播放 - const tryAutoPlay = () => { + const tryAutoPlay = (e) => { + console.log('尝试自动播放', e); if (this.audio.readyState >= 2 && (!this.audio.paused || this.shouldAutoPlay)) { this.play(); } @@ -1102,7 +1103,7 @@ class AudioPlayer { checkUrlParams() { // 获取URL参数 const urlParams = new URLSearchParams(window.location.search); - let filePath = urlParams.get('filePath'); + let filePath = urlParams.get('filePath') || ''; let fileName = urlParams.get('fileName') || '网络音乐'; try { @@ -1115,7 +1116,7 @@ class AudioPlayer { } catch (e) { } - if (filePath) { + if (filePath && filePath != '') { this.loadNetworkMusic(filePath, fileName); } }