修改playAudio的onerror

This commit is contained in:
shijian 2023-10-05 00:23:17 +08:00
parent 18b9c34525
commit c430e63dc3
1 changed files with 2 additions and 7 deletions

View File

@ -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);