From 7f26a798b4a0ed7eea98abb1ebc041b5fb187041 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Wed, 29 Nov 2023 12:13:56 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"chore:=20=E9=9F=B3=E5=A3=B0?= =?UTF-8?q?=E3=81=8C=E4=B8=80=E5=88=87=E9=B3=B4=E3=82=89=E3=81=AA=E3=81=8F?= =?UTF-8?q?=E3=81=AA=E3=82=8B=E5=8F=AF=E8=83=BD=E6=80=A7=E3=82=92=E8=BB=BD?= =?UTF-8?q?=E6=B8=9B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1dd79161fb8ef268af4314c38358eb173f70f697. --- packages/frontend/src/scripts/sound.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index a15f8ea0894a..bb3e901bf47d 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -83,17 +83,13 @@ export function play(type: 'noteMy' | 'note' | 'antenna' | 'channel' | 'notifica if (_DEV_) console.log('play', type, sound); if (sound.type == null || !canPlay) return; - (async () => { - canPlay = false; - try { - await playFile(sound.type, sound.volume); - } finally { - // ごく短時間に音が重複しないように - setTimeout(() => { - canPlay = true; - }, 25); - } - })(); + canPlay = false; + playFile(sound.type, sound.volume).then(() => { + // ごく短時間に音が重複しないように + setTimeout(() => { + canPlay = true; + }, 25); + }); } export async function playFile(file: string, volume: number) { From 3f858a675d258e6f5199d5a9959dd3a90847f543 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Wed, 29 Nov 2023 10:29:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=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=81=8C=E3=81=82=E3=82=8B=20(#1249?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 音声が一切鳴らなくなる可能性を軽減 https://github.com/misskey-dev/misskey/pull/12433#discussion_r1405774767 * chore: IIFEではなくPromise.prototype.finallyを使用するように --- packages/frontend/src/scripts/sound.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index bb3e901bf47d..6c00d62c7461 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -84,7 +84,7 @@ export function play(type: 'noteMy' | 'note' | 'antenna' | 'channel' | 'notifica if (sound.type == null || !canPlay) return; canPlay = false; - playFile(sound.type, sound.volume).then(() => { + playFile(sound).finally(() => { // ごく短時間に音が重複しないように setTimeout(() => { canPlay = true;