From a8e7f18bf7e4bc5decad9b78d1dc169c6068ce86 Mon Sep 17 00:00:00 2001 From: bofeng Date: Tue, 10 Oct 2023 11:05:50 +0800 Subject: [PATCH] Fix webaudio's bug: calling the 'checkEnded' interface after 'destroy' has been called can trigger a JavaScript error --- pal/audio/web/player-web.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/pal/audio/web/player-web.ts b/pal/audio/web/player-web.ts index 410e305d8d9..46fefbaf3ce 100644 --- a/pal/audio/web/player-web.ts +++ b/pal/audio/web/player-web.ts @@ -245,6 +245,7 @@ export class AudioPlayerWeb implements OperationQueueable { game.on(Game.EVENT_RESUME, this._onInterruptedEnd, this); } destroy (): void { + window.clearTimeout(this._currentTimer); this._audioTimer.destroy(); if (this._audioBuffer) { // NOTE: need to release AudioBuffer instance