From d361ebbb331a3de9ed4945f0443dbb050a6ac06f Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 27 Nov 2023 17:07:57 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=9F=B3=E5=A3=B0=E3=81=8C=E4=B8=80?= =?UTF-8?q?=E5=88=87=E9=B3=B4=E3=82=89=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=80=A7=E3=82=92=E8=BB=BD=E6=B8=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/misskey-dev/misskey/pull/12433#discussion_r1405774767 --- packages/frontend/src/scripts/sound.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index a4c6967d1831..b5e8967fea73 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -160,13 +160,17 @@ export function play(operationType: OperationType) { if (_DEV_) console.log('play', operationType, sound); if (sound.type == null || !canPlay) return; - canPlay = false; - playFile(sound).then(() => { - // ごく短時間に音が重複しないように - setTimeout(() => { - canPlay = true; - }, 25); - }); + (async () => { + canPlay = false; + try { + await playFile(sound); + } finally { + // ごく短時間に音が重複しないように + setTimeout(() => { + canPlay = true; + }, 25); + } + })(); } /**