From 9666253e09923e07dd057ffcaa82918b60cfd7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Wed, 3 Dec 2025 13:37:15 +0300 Subject: [PATCH] =?UTF-8?q?debug(notifications):=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BB=D0=BE=D0=B3=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=BE=D1=81?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B7=D0=B2=D1=83=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Логирование попыток воспроизведения MP3 - Логирование успеха/ошибок загрузки - Логирование переключения на fallback звук - Помогает диагностировать проблемы с аудио файлами --- .../js/notifications/notification-manager.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/static/js/notifications/notification-manager.js b/backend/static/js/notifications/notification-manager.js index 956320ad..317410b0 100644 --- a/backend/static/js/notifications/notification-manager.js +++ b/backend/static/js/notifications/notification-manager.js @@ -38,17 +38,25 @@ class NotificationManager { * Приоритет: 1) MP3 файл, 2) Web Audio API (fallback) */ playNotificationSound() { - if (!this.soundEnabled) return; + if (!this.soundEnabled) { + console.log('[Notifications] Sound disabled'); + return; + } try { // Попытка воспроизвести MP3 файл const audio = new Audio('/static/sounds/notification.mp3'); audio.volume = 0.3; - audio.play().catch(() => { + console.log('[Notifications] Playing MP3 sound'); + audio.play().then(() => { + console.log('[Notifications] MP3 sound played successfully'); + }).catch((err) => { + console.warn('[Notifications] MP3 playback failed, using fallback:', err); // Fallback на Web Audio API если MP3 недоступен this.playFallbackSound(); }); } catch (error) { + console.warn('[Notifications] MP3 loading failed, using fallback:', error); // Fallback на Web Audio API this.playFallbackSound(); } @@ -58,6 +66,7 @@ class NotificationManager { * Резервный метод: синтетический звук через Web Audio API */ playFallbackSound() { + console.log('[Notifications] Playing fallback Web Audio API sound'); try { const audioContext = new (window.AudioContext || window.webkitAudioContext)(); const oscillator = audioContext.createOscillator(); @@ -74,6 +83,7 @@ class NotificationManager { oscillator.start(audioContext.currentTime); oscillator.stop(audioContext.currentTime + 0.3); + console.log('[Notifications] Fallback sound completed'); } catch (error) { console.warn('[Notifications] Sound playback failed:', error); }