Compare commits
1 Commits
dev/player
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 102e3c677c |
17
README.md
17
README.md
@@ -1,3 +1,18 @@
|
|||||||
# music-storage
|
# music-storage
|
||||||
|
|
||||||
Мини сервис для хранения/загрузки/воспроизведении песен
|
Мини сервис для хранения/загрузки/воспроизведении песен
|
||||||
|
|
||||||
|
Пример сервиса: https://music.nervy.pro
|
||||||
|
|
||||||
|
|
||||||
|
## environment
|
||||||
|
|
||||||
|
- переименовать `music_storage/.env.example` -> `music_storage/.env`
|
||||||
|
- заполнить `.env`
|
||||||
|
|
||||||
|
## Запуск
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd music_storage
|
||||||
|
uv run python manage.py runserver
|
||||||
|
```
|
||||||
@@ -8,9 +8,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const playPauseBtn = document.getElementById('playPauseBtn');
|
const playPauseBtn = document.getElementById('playPauseBtn');
|
||||||
const nextBtn = document.getElementById('nextBtn');
|
const nextBtn = document.getElementById('nextBtn');
|
||||||
const prevBtn = document.getElementById('prevBtn');
|
const prevBtn = document.getElementById('prevBtn');
|
||||||
const volumeControl = document.getElementById('volumeControl');
|
|
||||||
const savedVolume = localStorage.getItem('audioPlayerVolume');
|
|
||||||
|
|
||||||
|
|
||||||
const progressBar = document.getElementById('audioProgress');
|
const progressBar = document.getElementById('audioProgress');
|
||||||
const currentTimeElem = document.getElementById('currentTime');
|
const currentTimeElem = document.getElementById('currentTime');
|
||||||
@@ -37,17 +34,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
if (currentTimeElem) currentTimeElem.textContent = formatTime(current || 0);
|
if (currentTimeElem) currentTimeElem.textContent = formatTime(current || 0);
|
||||||
if (durationElem) durationElem.textContent = formatTime(duration || 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', () => {
|
audioPlayer.addEventListener('timeupdate', () => {
|
||||||
|
|||||||
@@ -15,16 +15,6 @@
|
|||||||
<button class="control-btn" id="prevBtn"><i class="fas fa-backward"></i></button>
|
<button class="control-btn" id="prevBtn"><i class="fas fa-backward"></i></button>
|
||||||
<button class="control-btn" id="playPauseBtn"><i class="fas fa-play"></i></button>
|
<button class="control-btn" id="playPauseBtn"><i class="fas fa-play"></i></button>
|
||||||
<button class="control-btn" id="nextBtn"><i class="fas fa-forward"></i></button>
|
<button class="control-btn" id="nextBtn"><i class="fas fa-forward"></i></button>
|
||||||
|
|
||||||
<input
|
|
||||||
type="range"
|
|
||||||
id="volumeControl"
|
|
||||||
min="0"
|
|
||||||
max="1"
|
|
||||||
step="0.01"
|
|
||||||
value="1"
|
|
||||||
title="Громкость"
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<audio id="audioPlayer" class="audio-player" preload="metadata">
|
<audio id="audioPlayer" class="audio-player" preload="metadata">
|
||||||
|
|||||||
Reference in New Issue
Block a user