feat: [notification] 알림음 미리듣기 실제 재생 + 음원 파일 배치

- default.wav, sam_voice.wav 실제 음원 파일 배치 (MNG에서 복사)
- playPreviewSound()를 Audio API 기반 실제 재생으로 변경
- types.ts 주석 업데이트 (soundType API 연동 완료)
This commit is contained in:
김보곤
2026-03-18 11:22:46 +09:00
parent 06233387b0
commit 366ce78b7c
5 changed files with 20 additions and 28 deletions

View File

@@ -29,13 +29,26 @@ import { saveNotificationSettings } from './actions';
import { ItemSettingsDialog } from './ItemSettingsDialog';
// 미리듣기 함수
let previewAudio: HTMLAudioElement | null = null;
function playPreviewSound(soundType: SoundType) {
if (soundType === 'mute') {
toast.info('무음으로 설정되어 있습니다.');
return;
}
const soundName = soundType === 'default' ? '기본 알림음' : 'SAM 보이스';
toast.info(`${soundName} 미리듣기`);
// 이전 재생 중지
if (previewAudio) {
previewAudio.pause();
previewAudio = null;
}
const soundFile = soundType === 'sam_voice' ? 'sam_voice.wav' : 'default.wav';
previewAudio = new Audio(`/sounds/${soundFile}`);
previewAudio.play().catch(() => {
const soundName = soundType === 'default' ? '기본 알림음' : 'SAM 보이스';
toast.info(`${soundName} 미리듣기`);
});
}
// 알림 항목 컴포넌트