Skip to content

Commit

Permalink
Merge pull request #202 from anatawa12/fix-deck-ui-sound-nirila
Browse files Browse the repository at this point in the history
fix: deck uiの通知音が重なる問題
  • Loading branch information
anatawa12 committed Jun 20, 2024
2 parents 79d01cc + 93c6708 commit ef28b79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Client
- Fix: ウィジェットでVRTL/VSTLが使用できない問題を修正
- Fix: deck uiの通知音が重なる問題 (#14029)

### Server
- Enhance: `vmimiRelayTimelineImplemented``disableVmimiRelayTimeline` nodeinfo に追加しました
Expand Down
11 changes: 9 additions & 2 deletions packages/frontend/src/scripts/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,16 @@ export async function loadAudio(url: string, options?: { useCache?: boolean; })
export function playMisskeySfx(operationType: OperationType) {
const sound = defaultStore.state[`sound_${operationType}`];
if (sound.type == null || !canPlay || ('userActivation' in navigator && !navigator.userActivation.hasBeenActive)) return;
playMisskeySfxFile(sound);
}

export async function playMisskeySfxFile(soundStore: SoundStore) {
if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) {
return;
}

canPlay = false;
playMisskeySfxFile(sound).finally(() => {
playMisskeySfxFileInternal(soundStore).finally(() => {
// ごく短時間に音が重複しないように
setTimeout(() => {
canPlay = true;
Expand All @@ -141,7 +148,7 @@ export function playMisskeySfx(operationType: OperationType) {
* サウンド設定形式で指定された音声を再生する
* @param soundStore サウンド設定
*/
export async function playMisskeySfxFile(soundStore: SoundStore) {
export async function playMisskeySfxFileInternal(soundStore: SoundStore) {
if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) {
return;
}
Expand Down

0 comments on commit ef28b79

Please sign in to comment.