CREARE MUSICA SOTTO FONDO PER IL MIO SITO - Initial Deployment
Browse files- README.md +6 -4
- index.html +351 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: purple
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: zz
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: purple
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,351 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="it">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Sito con Musica di Sottofondo</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
/* Animazione per il pulsante play/pause */
|
| 11 |
+
@keyframes pulse {
|
| 12 |
+
0% { transform: scale(1); }
|
| 13 |
+
50% { transform: scale(1.1); }
|
| 14 |
+
100% { transform: scale(1); }
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.pulse-animation {
|
| 18 |
+
animation: pulse 2s infinite;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/* Stile per la barra di progresso */
|
| 22 |
+
input[type="range"] {
|
| 23 |
+
-webkit-appearance: none;
|
| 24 |
+
height: 6px;
|
| 25 |
+
background: #e2e8f0;
|
| 26 |
+
border-radius: 5px;
|
| 27 |
+
background-image: linear-gradient(#3b82f6, #3b82f6);
|
| 28 |
+
background-size: 0% 100%;
|
| 29 |
+
background-repeat: no-repeat;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
input[type="range"]::-webkit-slider-thumb {
|
| 33 |
+
-webkit-appearance: none;
|
| 34 |
+
height: 16px;
|
| 35 |
+
width: 16px;
|
| 36 |
+
border-radius: 50%;
|
| 37 |
+
background: #3b82f6;
|
| 38 |
+
cursor: pointer;
|
| 39 |
+
box-shadow: 0 0 2px 0 #555;
|
| 40 |
+
transition: all .3s ease;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
input[type="range"]::-webkit-slider-thumb:hover {
|
| 44 |
+
transform: scale(1.2);
|
| 45 |
+
background: #2563eb;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/* Transizione per il player */
|
| 49 |
+
.music-player {
|
| 50 |
+
transition: all 0.3s ease;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/* Stile per il volume */
|
| 54 |
+
.volume-container:hover .volume-slider {
|
| 55 |
+
opacity: 1;
|
| 56 |
+
width: 100px;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.volume-slider {
|
| 60 |
+
transition: all 0.3s ease;
|
| 61 |
+
width: 0;
|
| 62 |
+
opacity: 0;
|
| 63 |
+
}
|
| 64 |
+
</style>
|
| 65 |
+
</head>
|
| 66 |
+
<body class="bg-gray-100 min-h-screen flex flex-col">
|
| 67 |
+
<!-- Navbar -->
|
| 68 |
+
<nav class="bg-white shadow-lg">
|
| 69 |
+
<div class="max-w-6xl mx-auto px-4">
|
| 70 |
+
<div class="flex justify-between items-center py-4">
|
| 71 |
+
<div class="text-2xl font-bold text-blue-600">Il Mio Sito</div>
|
| 72 |
+
<div class="hidden md:flex space-x-8">
|
| 73 |
+
<a href="#" class="text-gray-700 hover:text-blue-600">Home</a>
|
| 74 |
+
<a href="#" class="text-gray-700 hover:text-blue-600">Servizi</a>
|
| 75 |
+
<a href="#" class="text-gray-700 hover:text-blue-600">Contatti</a>
|
| 76 |
+
<a href="#" class="text-gray-700 hover:text-blue-600">Chi Siamo</a>
|
| 77 |
+
</div>
|
| 78 |
+
<div class="md:hidden">
|
| 79 |
+
<button class="text-gray-700 focus:outline-none">
|
| 80 |
+
<i class="fas fa-bars text-xl"></i>
|
| 81 |
+
</button>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
</nav>
|
| 86 |
+
|
| 87 |
+
<!-- Contenuto principale -->
|
| 88 |
+
<main class="flex-grow container mx-auto px-4 py-8">
|
| 89 |
+
<h1 class="text-4xl font-bold text-center text-gray-800 mb-8">Benvenuto nel mio sito</h1>
|
| 90 |
+
|
| 91 |
+
<div class="bg-white rounded-lg shadow-md p-6 max-w-3xl mx-auto">
|
| 92 |
+
<p class="text-gray-700 mb-4">Questo è un esempio di sito con musica di sottofondo. Il player musicale è posizionato in basso a destra e rimane fisso mentre navighi nel sito.</p>
|
| 93 |
+
<p class="text-gray-700 mb-4">Puoi mettere in pausa la musica, regolare il volume o cambiare tracce usando i controlli del player.</p>
|
| 94 |
+
<p class="text-gray-700">La musica riprenderà automaticamente quando torni su questa pagina, a meno che tu non l'abbia messa in pausa manualmente.</p>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<div class="grid md:grid-cols-2 gap-6 mt-8 max-w-4xl mx-auto">
|
| 98 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 99 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-4">Feature 1</h2>
|
| 100 |
+
<p class="text-gray-700">Descrizione della prima feature del tuo sito. Puoi aggiungere qualsiasi contenuto qui.</p>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 103 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-4">Feature 2</h2>
|
| 104 |
+
<p class="text-gray-700">Descrizione della seconda feature del tuo sito. Personalizza questo contenuto come preferisci.</p>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</main>
|
| 108 |
+
|
| 109 |
+
<!-- Footer -->
|
| 110 |
+
<footer class="bg-gray-800 text-white py-6">
|
| 111 |
+
<div class="container mx-auto px-4 text-center">
|
| 112 |
+
<p>© 2023 Il Mio Sito. Tutti i diritti riservati.</p>
|
| 113 |
+
</div>
|
| 114 |
+
</footer>
|
| 115 |
+
|
| 116 |
+
<!-- Player musicale -->
|
| 117 |
+
<div class="fixed bottom-4 right-4 music-player bg-white rounded-lg shadow-xl p-4 w-72 z-50">
|
| 118 |
+
<div class="flex items-center justify-between mb-3">
|
| 119 |
+
<div class="flex items-center">
|
| 120 |
+
<div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mr-3">
|
| 121 |
+
<i class="fas fa-music text-blue-600 text-xl"></i>
|
| 122 |
+
</div>
|
| 123 |
+
<div>
|
| 124 |
+
<h3 class="font-semibold text-gray-800" id="song-title">Canzone di Sottofondo</h3>
|
| 125 |
+
<p class="text-xs text-gray-500" id="song-artist">Artista Sconosciuto</p>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
| 128 |
+
<button id="toggle-player" class="text-gray-500 hover:text-gray-700">
|
| 129 |
+
<i class="fas fa-times"></i>
|
| 130 |
+
</button>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<div id="player-controls" class="flex flex-col">
|
| 134 |
+
<div class="flex items-center justify-between mb-2">
|
| 135 |
+
<span class="text-xs text-gray-500" id="current-time">0:00</span>
|
| 136 |
+
<input type="range" id="progress-bar" class="flex-grow mx-2" value="0">
|
| 137 |
+
<span class="text-xs text-gray-500" id="duration">0:00</span>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<div class="flex items-center justify-between">
|
| 141 |
+
<button id="prev-btn" class="text-gray-700 hover:text-blue-600 p-2">
|
| 142 |
+
<i class="fas fa-step-backward"></i>
|
| 143 |
+
</button>
|
| 144 |
+
<button id="play-btn" class="bg-blue-600 text-white rounded-full w-10 h-10 flex items-center justify-center hover:bg-blue-700 pulse-animation">
|
| 145 |
+
<i class="fas fa-play" id="play-icon"></i>
|
| 146 |
+
</button>
|
| 147 |
+
<button id="next-btn" class="text-gray-700 hover:text-blue-600 p-2">
|
| 148 |
+
<i class="fas fa-step-forward"></i>
|
| 149 |
+
</button>
|
| 150 |
+
<div class="volume-container flex items-center ml-2">
|
| 151 |
+
<button id="volume-btn" class="text-gray-700 hover:text-blue-600 p-2">
|
| 152 |
+
<i class="fas fa-volume-up" id="volume-icon"></i>
|
| 153 |
+
</button>
|
| 154 |
+
<input type="range" id="volume-slider" class="volume-slider ml-1" min="0" max="1" step="0.01" value="0.5">
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<!-- Audio element (hidden) -->
|
| 161 |
+
<audio id="audio-player" loop>
|
| 162 |
+
<!-- Puoi aggiungere più sorgenti audio per diversi formati -->
|
| 163 |
+
<source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" type="audio/mpeg">
|
| 164 |
+
Il tuo browser non supporta l'elemento audio.
|
| 165 |
+
</audio>
|
| 166 |
+
|
| 167 |
+
<script>
|
| 168 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 169 |
+
// Elementi del DOM
|
| 170 |
+
const audioPlayer = document.getElementById('audio-player');
|
| 171 |
+
const playBtn = document.getElementById('play-btn');
|
| 172 |
+
const playIcon = document.getElementById('play-icon');
|
| 173 |
+
const prevBtn = document.getElementById('prev-btn');
|
| 174 |
+
const nextBtn = document.getElementById('next-btn');
|
| 175 |
+
const progressBar = document.getElementById('progress-bar');
|
| 176 |
+
const currentTimeEl = document.getElementById('current-time');
|
| 177 |
+
const durationEl = document.getElementById('duration');
|
| 178 |
+
const volumeBtn = document.getElementById('volume-btn');
|
| 179 |
+
const volumeIcon = document.getElementById('volume-icon');
|
| 180 |
+
const volumeSlider = document.getElementById('volume-slider');
|
| 181 |
+
const togglePlayerBtn = document.getElementById('toggle-player');
|
| 182 |
+
const musicPlayer = document.querySelector('.music-player');
|
| 183 |
+
const songTitle = document.getElementById('song-title');
|
| 184 |
+
const songArtist = document.getElementById('song-artist');
|
| 185 |
+
|
| 186 |
+
// Lista di brani (puoi aggiungere i tuoi)
|
| 187 |
+
const songs = [
|
| 188 |
+
{
|
| 189 |
+
title: "Melodia Rilassante",
|
| 190 |
+
artist: "Natura Sonora",
|
| 191 |
+
src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
title: "Armonia Celeste",
|
| 195 |
+
artist: "Pace Interiore",
|
| 196 |
+
src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3"
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
title: "Sinfonia del Mattino",
|
| 200 |
+
artist: "Alba Musicale",
|
| 201 |
+
src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3"
|
| 202 |
+
}
|
| 203 |
+
];
|
| 204 |
+
|
| 205 |
+
let currentSongIndex = 0;
|
| 206 |
+
let isPlaying = false;
|
| 207 |
+
let isPlayerVisible = true;
|
| 208 |
+
|
| 209 |
+
// Carica la canzone corrente
|
| 210 |
+
function loadSong() {
|
| 211 |
+
const song = songs[currentSongIndex];
|
| 212 |
+
songTitle.textContent = song.title;
|
| 213 |
+
songArtist.textContent = song.artist;
|
| 214 |
+
audioPlayer.src = song.src;
|
| 215 |
+
|
| 216 |
+
// Se la musica era in riproduzione, continua a riprodurre
|
| 217 |
+
if (isPlaying) {
|
| 218 |
+
audioPlayer.play().catch(e => console.log("Errore riproduzione automatica:", e));
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Riproduci la canzone
|
| 223 |
+
function playSong() {
|
| 224 |
+
isPlaying = true;
|
| 225 |
+
playIcon.classList.replace('fa-play', 'fa-pause');
|
| 226 |
+
playBtn.classList.add('pulse-animation');
|
| 227 |
+
audioPlayer.play().catch(e => console.log("Errore riproduzione automatica:", e));
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
// Metti in pausa la canzone
|
| 231 |
+
function pauseSong() {
|
| 232 |
+
isPlaying = false;
|
| 233 |
+
playIcon.classList.replace('fa-pause', 'fa-play');
|
| 234 |
+
playBtn.classList.remove('pulse-animation');
|
| 235 |
+
audioPlayer.pause();
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
// Canzone successiva
|
| 239 |
+
function nextSong() {
|
| 240 |
+
currentSongIndex = (currentSongIndex + 1) % songs.length;
|
| 241 |
+
loadSong();
|
| 242 |
+
if (isPlaying) playSong();
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
// Canzone precedente
|
| 246 |
+
function prevSong() {
|
| 247 |
+
currentSongIndex = (currentSongIndex - 1 + songs.length) % songs.length;
|
| 248 |
+
loadSong();
|
| 249 |
+
if (isPlaying) playSong();
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
// Aggiorna la barra di progresso
|
| 253 |
+
function updateProgress() {
|
| 254 |
+
const { duration, currentTime } = audioPlayer;
|
| 255 |
+
const progressPercent = (currentTime / duration) * 100;
|
| 256 |
+
progressBar.style.backgroundSize = `${progressPercent}% 100%`;
|
| 257 |
+
progressBar.value = progressPercent;
|
| 258 |
+
|
| 259 |
+
// Formatta il tempo
|
| 260 |
+
const durationMinutes = Math.floor(duration / 60);
|
| 261 |
+
let durationSeconds = Math.floor(duration % 60);
|
| 262 |
+
if (durationSeconds < 10) durationSeconds = `0${durationSeconds}`;
|
| 263 |
+
|
| 264 |
+
// Evita NaN
|
| 265 |
+
if (durationSeconds) {
|
| 266 |
+
durationEl.textContent = `${durationMinutes}:${durationSeconds}`;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
const currentMinutes = Math.floor(currentTime / 60);
|
| 270 |
+
let currentSeconds = Math.floor(currentTime % 60);
|
| 271 |
+
if (currentSeconds < 10) currentSeconds = `0${currentSeconds}`;
|
| 272 |
+
currentTimeEl.textContent = `${currentMinutes}:${currentSeconds}`;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
// Imposta la posizione della canzone
|
| 276 |
+
function setProgress(e) {
|
| 277 |
+
const width = this.clientWidth;
|
| 278 |
+
const clickX = e.offsetX;
|
| 279 |
+
const duration = audioPlayer.duration;
|
| 280 |
+
audioPlayer.currentTime = (clickX / width) * duration;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
// Imposta il volume
|
| 284 |
+
function setVolume() {
|
| 285 |
+
const volume = this.value;
|
| 286 |
+
audioPlayer.volume = volume;
|
| 287 |
+
|
| 288 |
+
// Cambia icona in base al volume
|
| 289 |
+
if (volume == 0) {
|
| 290 |
+
volumeIcon.className = 'fas fa-volume-mute';
|
| 291 |
+
} else if (volume < 0.5) {
|
| 292 |
+
volumeIcon.className = 'fas fa-volume-down';
|
| 293 |
+
} else {
|
| 294 |
+
volumeIcon.className = 'fas fa-volume-up';
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
// Toggle per mostrare/nascondere il player
|
| 299 |
+
function togglePlayer() {
|
| 300 |
+
isPlayerVisible = !isPlayerVisible;
|
| 301 |
+
if (isPlayerVisible) {
|
| 302 |
+
musicPlayer.classList.remove('hidden');
|
| 303 |
+
togglePlayerBtn.innerHTML = '<i class="fas fa-times"></i>';
|
| 304 |
+
} else {
|
| 305 |
+
musicPlayer.classList.add('hidden');
|
| 306 |
+
togglePlayerBtn.innerHTML = '<i class="fas fa-music"></i>';
|
| 307 |
+
// Sposta il pulsante toggle in basso a destra quando il player è nascosto
|
| 308 |
+
togglePlayerBtn.style.position = 'fixed';
|
| 309 |
+
togglePlayerBtn.style.bottom = '20px';
|
| 310 |
+
togglePlayerBtn.style.right = '20px';
|
| 311 |
+
togglePlayerBtn.style.zIndex = '50';
|
| 312 |
+
togglePlayerBtn.style.backgroundColor = 'white';
|
| 313 |
+
togglePlayerBtn.style.padding = '10px';
|
| 314 |
+
togglePlayerBtn.style.borderRadius = '50%';
|
| 315 |
+
togglePlayerBtn.style.boxShadow = '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)';
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
// Event listeners
|
| 320 |
+
playBtn.addEventListener('click', () => {
|
| 321 |
+
isPlaying ? pauseSong() : playSong();
|
| 322 |
+
});
|
| 323 |
+
|
| 324 |
+
prevBtn.addEventListener('click', prevSong);
|
| 325 |
+
nextBtn.addEventListener('click', nextSong);
|
| 326 |
+
|
| 327 |
+
audioPlayer.addEventListener('timeupdate', updateProgress);
|
| 328 |
+
audioPlayer.addEventListener('ended', nextSong);
|
| 329 |
+
|
| 330 |
+
progressBar.addEventListener('click', setProgress);
|
| 331 |
+
|
| 332 |
+
volumeSlider.addEventListener('input', setVolume);
|
| 333 |
+
|
| 334 |
+
togglePlayerBtn.addEventListener('click', togglePlayer);
|
| 335 |
+
|
| 336 |
+
// Imposta il volume iniziale
|
| 337 |
+
audioPlayer.volume = volumeSlider.value;
|
| 338 |
+
|
| 339 |
+
// Carica la prima canzone
|
| 340 |
+
loadSong();
|
| 341 |
+
|
| 342 |
+
// Riproduci automaticamente (con gestione degli errori per i browser che bloccano l'auto-play)
|
| 343 |
+
playSong();
|
| 344 |
+
audioPlayer.play().catch(e => {
|
| 345 |
+
console.log("Riproduzione automatica bloccata. L'utente deve interagire prima.");
|
| 346 |
+
pauseSong();
|
| 347 |
+
});
|
| 348 |
+
});
|
| 349 |
+
</script>
|
| 350 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ecoradio/zz" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 351 |
+
</html>
|