From e1991d4a12fe1f5445d57c18841e9eeb6b599ecc Mon Sep 17 00:00:00 2001 From: Viner Abubakirov Date: Tue, 20 Jan 2026 19:49:48 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=B7=D1=83=D0=BD=D0=BE=D0=BA=20=D0=B3=D1=80?= =?UTF-8?q?=D0=BE=D0=BC=D0=BA=D0=BE=D1=81=D1=82=D0=B8=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BB=D0=B5=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- music_storage/static/js/player.js | 14 ++++++++++++++ music_storage/templates/components/player.html | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/music_storage/static/js/player.js b/music_storage/static/js/player.js index fee0a0d..ee1bbac 100644 --- a/music_storage/static/js/player.js +++ b/music_storage/static/js/player.js @@ -8,6 +8,9 @@ document.addEventListener('DOMContentLoaded', function () { const playPauseBtn = document.getElementById('playPauseBtn'); const nextBtn = document.getElementById('nextBtn'); const prevBtn = document.getElementById('prevBtn'); + const volumeControl = document.getElementById('volumeControl'); + const savedVolume = localStorage.getItem('audioPlayerVolume'); + const progressBar = document.getElementById('audioProgress'); const currentTimeElem = document.getElementById('currentTime'); @@ -34,6 +37,17 @@ document.addEventListener('DOMContentLoaded', function () { if (currentTimeElem) currentTimeElem.textContent = formatTime(current || 0); if (durationElem) durationElem.textContent = formatTime(duration || 0); } + // Восстановление сохраненного уровня громкости + if (savedVolume !== null) { + audioPlayer.volume = parseFloat(savedVolume); + } + + // Управление громкостью + if (volumeControl) { + volumeControl.addEventListener('input', () => { + audioPlayer.volume = volumeControl.value; + }); + } // Обновление прогресса при воспроизведении audioPlayer.addEventListener('timeupdate', () => { diff --git a/music_storage/templates/components/player.html b/music_storage/templates/components/player.html index c003ed9..83ef349 100644 --- a/music_storage/templates/components/player.html +++ b/music_storage/templates/components/player.html @@ -15,6 +15,16 @@ + +