From c430e63dc302c47c061320528d5bca21d03543cd Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Thu, 5 Oct 2023 00:23:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9playAudio=E7=9A=84onerror?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/game/game.js b/game/game.js index fb1317603..9b9ff81ab 100644 --- a/game/game.js +++ b/game/game.js @@ -34960,13 +34960,8 @@ audio.volume=lib.config.volumn_audio/8; audio.addEventListener('ended',()=>audio.remove()); audio.onerror=event=>{ - if(audio._changed){ - audio.remove(); - if(onError) onError(event); - return; - } - audio.src=`${lib.assetURL}audio/${path}.ogg`; - audio._changed=true; + audio.remove(); + if(onError) onError(event); }; //Some browsers do not support "autoplay", so "oncanplay" listening has been added audio.oncanplay=()=>Promise.resolve(audio.play()).catch(()=>void 0);