Skip to content

Commit 865b303

Browse files
anatawa12Sayamame-beanssyuilo
authored
fix: deck uiの通知音が重なる問題 (#14029)
* fix: deck uiの通知音が重なる * docs: Fix: deck uiの通知音が重なる問題 * unexport internal function * fix Co-authored-by: Sayamame-beans <[email protected]> * chore: improve condition * docs: move js dco comment --------- Co-authored-by: Sayamame-beans <[email protected]> Co-authored-by: syuilo <[email protected]>
1 parent efa80f9 commit 865b303

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
- Fix: リアクションしたユーザー一覧のユーザー名がはみ出る問題を修正
4242
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/672)
4343
- Fix: `/share`ページにおいて絵文字ピッカーを開くことができない問題を修正
44+
- Fix: deck uiの通知音が重なる問題 (#14029)
4445
- Fix: ダイレクト投稿の"削除して編集"において、宛先が保持されていなかった問題を修正
4546
- Fix: 投稿フォームへのURL貼り付けによる引用が下書きに保存されていなかった問題を修正
4647
- Fix: "削除して編集"や下書きにおいて、リアクションの受け入れ設定が保持/保存されていなかった問題を修正

packages/frontend/src/scripts/sound.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,31 @@ export async function loadAudio(url: string, options?: { useCache?: boolean; })
124124
*/
125125
export function playMisskeySfx(operationType: OperationType) {
126126
const sound = defaultStore.state[`sound_${operationType}`];
127-
if (sound.type == null || !canPlay || ('userActivation' in navigator && !navigator.userActivation.hasBeenActive)) return;
127+
playMisskeySfxFile(sound);
128+
}
129+
130+
/**
131+
* サウンド設定形式で指定された音声を再生する
132+
* @param soundStore サウンド設定
133+
*/
134+
export function playMisskeySfxFile(soundStore: SoundStore) {
135+
// 連続して再生しない
136+
if (!canPlay) return;
137+
// ユーザーアクティベーションが必要な場合はそれがない場合は再生しない
138+
if ('userActivation' in navigator && !navigator.userActivation.hasBeenActive) return;
139+
// サウンドがない場合は再生しない
140+
if (soundStore.type === null || soundStore.type === '_driveFile_' && !soundStore.fileUrl) return;
128141

129142
canPlay = false;
130-
playMisskeySfxFile(sound).finally(() => {
143+
playMisskeySfxFileInternal(soundStore).finally(() => {
131144
// ごく短時間に音が重複しないように
132145
setTimeout(() => {
133146
canPlay = true;
134147
}, 25);
135148
});
136149
}
137150

138-
/**
139-
* サウンド設定形式で指定された音声を再生する
140-
* @param soundStore サウンド設定
141-
*/
142-
export async function playMisskeySfxFile(soundStore: SoundStore) {
151+
async function playMisskeySfxFileInternal(soundStore: SoundStore) {
143152
if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) {
144153
return;
145154
}

0 commit comments

Comments
 (0)