spotify / index.html
ztrem's picture
Add 3 files
37baee4 verified
Raw History Blame Contribute Delete
24.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spotify Clone</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');
body {
font-family: 'Montserrat', sans-serif;
background-color: #121212;
color: white;
}
.progress-bar {
height: 4px;
background-color: #535353;
border-radius: 2px;
}
.progress-fill {
height: 100%;
background-color: #1DB954;
border-radius: 2px;
width: 0%;
transition: width 0.1s linear;
}
.album-art {
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.playing {
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.03); }
100% { transform: scale(1); }
}
.volume-slider {
-webkit-appearance: none;
width: 100px;
height: 4px;
background: #535353;
border-radius: 2px;
outline: none;
}
.volume-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 12px;
border-radius: 50%;
background: white;
cursor: pointer;
}
.playlist-item:hover {
background-color: #2A2A2A;
}
.playlist-item.active {
background-color: #2A2A2A;
border-left: 3px solid #1DB954;
}
</style>
</head>
<body class="h-screen flex overflow-hidden">
<!-- Sidebar -->
<div class="w-64 bg-black h-full flex flex-col">
<div class="p-6">
<div class="text-white text-2xl font-bold flex items-center">
<i class="fab fa-spotify text-3xl text-green-500 mr-2"></i>
Spotify
</div>
</div>
<div class="px-6 py-4">
<div class="text-gray-400 uppercase text-xs font-semibold tracking-wider mb-4">Menu</div>
<ul class="space-y-3">
<li>
<a href="#" class="flex items-center text-white hover:text-green-500">
<i class="fas fa-home text-xl mr-4"></i>
<span>Home</span>
</a>
</li>
<li>
<a href="#" class="flex items-center text-gray-400 hover:text-white">
<i class="fas fa-search text-xl mr-4"></i>
<span>Search</span>
</a>
</li>
<li>
<a href="#" class="flex items-center text-gray-400 hover:text-white">
<i class="fas fa-book text-xl mr-4"></i>
<span>Your Library</span>
</a>
</li>
</ul>
</div>
<div class="px-6 py-4 mt-4">
<div class="text-gray-400 uppercase text-xs font-semibold tracking-wider mb-4">Playlists</div>
<ul class="space-y-3">
<li>
<a href="#" class="flex items-center text-gray-400 hover:text-white">
<i class="fas fa-plus-circle text-xl mr-4"></i>
<span>Create Playlist</span>
</a>
</li>
<li>
<a href="#" class="flex items-center text-gray-400 hover:text-white">
<i class="fas fa-heart text-xl mr-4"></i>
<span>Liked Songs</span>
</a>
</li>
</ul>
</div>
<div class="border-t border-gray-800 mt-auto p-6">
<div class="flex items-center">
<div class="w-8 h-8 bg-gray-600 rounded-full flex items-center justify-center mr-2">
<i class="fas fa-user text-sm"></i>
</div>
<div class="text-white">User Profile</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Top Navigation -->
<div class="bg-gradient-to-r from-purple-900 to-blue-900 p-6">
<div class="flex justify-between items-center">
<div class="flex space-x-4">
<button class="bg-black bg-opacity-30 rounded-full w-8 h-8 flex items-center justify-center">
<i class="fas fa-chevron-left"></i>
</button>
<button class="bg-black bg-opacity-30 rounded-full w-8 h-8 flex items-center justify-center">
<i class="fas fa-chevron-right"></i>
</button>
</div>
<div class="flex items-center space-x-4">
<button class="bg-white text-black px-4 py-1 rounded-full text-sm font-bold hover:scale-105 transition">Upgrade</button>
<div class="flex items-center bg-black bg-opacity-70 rounded-full px-3 py-1">
<div class="w-6 h-6 bg-green-500 rounded-full mr-2"></div>
<span class="text-sm">User</span>
<i class="fas fa-chevron-down ml-2 text-xs"></i>
</div>
</div>
</div>
</div>
<!-- Content Area -->
<div class="flex-1 overflow-y-auto p-6 bg-gradient-to-b from-blue-900 to-gray-900">
<h1 class="text-3xl font-bold mb-6">Good afternoon</h1>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4 mb-8">
<div class="bg-gray-800 bg-opacity-40 hover:bg-gray-700 rounded-md p-4 flex items-center cursor-pointer transition">
<div class="w-16 h-16 bg-gradient-to-br from-purple-500 to-blue-500 rounded-md mr-4"></div>
<span class="font-semibold">Liked Songs</span>
</div>
<div class="bg-gray-800 bg-opacity-40 hover:bg-gray-700 rounded-md p-4 flex items-center cursor-pointer transition">
<div class="w-16 h-16 bg-gradient-to-br from-green-500 to-blue-500 rounded-md mr-4"></div>
<span class="font-semibold">Discover Weekly</span>
</div>
<div class="bg-gray-800 bg-opacity-40 hover:bg-gray-700 rounded-md p-4 flex items-center cursor-pointer transition">
<div class="w-16 h-16 bg-gradient-to-br from-red-500 to-yellow-500 rounded-md mr-4"></div>
<span class="font-semibold">Top Hits</span>
</div>
<div class="bg-gray-800 bg-opacity-40 hover:bg-gray-700 rounded-md p-4 flex items-center cursor-pointer transition">
<div class="w-16 h-16 bg-gradient-to-br from-pink-500 to-purple-500 rounded-md mr-4"></div>
<span class="font-semibold">Chill Vibes</span>
</div>
<div class="bg-gray-800 bg-opacity-40 hover:bg-gray-700 rounded-md p-4 flex items-center cursor-pointer transition">
<div class="w-16 h-16 bg-gradient-to-br from-yellow-500 to-red-500 rounded-md mr-4"></div>
<span class="font-semibold">Workout Mix</span>
</div>
<div class="bg-gray-800 bg-opacity-40 hover:bg-gray-700 rounded-md p-4 flex items-center cursor-pointer transition">
<div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-green-500 rounded-md mr-4"></div>
<span class="font-semibold">Indie Mix</span>
</div>
</div>
<h2 class="text-2xl font-bold mb-4">Recently played</h2>
<div class="relative">
<div class="overflow-x-auto">
<table class="w-full text-gray-400">
<thead>
<tr class="border-b border-gray-800 text-left text-sm uppercase tracking-wider">
<th class="pb-2 pl-2">#</th>
<th class="pb-2">Title</th>
<th class="pb-2">Album</th>
<th class="pb-2">Date Added</th>
<th class="pb-2 pr-2"><i class="far fa-clock"></i></th>
</tr>
</thead>
<tbody id="playlist">
<!-- Songs will be added here by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Player Bar -->
<div class="h-20 bg-gray-900 border-t border-gray-800 flex items-center px-4">
<div class="w-1/4 flex items-center">
<div class="w-14 h-14 bg-gray-700 rounded mr-3 album-art" id="current-album-art">
<img src="" alt="" class="w-full h-full object-cover rounded" id="current-album-img">
</div>
<div>
<div class="text-white text-sm font-medium" id="current-song-title">Not playing</div>
<div class="text-gray-400 text-xs" id="current-song-artist">-</div>
</div>
<button class="ml-4 text-gray-400 hover:text-white">
<i class="far fa-heart"></i>
</button>
</div>
<div class="w-2/4 flex flex-col items-center">
<div class="flex items-center space-x-6 mb-2">
<button class="text-gray-400 hover:text-white text-lg" id="shuffle-btn">
<i class="fas fa-random"></i>
</button>
<button class="text-gray-400 hover:text-white text-xl" id="prev-btn">
<i class="fas fa-step-backward"></i>
</button>
<button class="bg-white rounded-full w-8 h-8 flex items-center justify-center text-black hover:scale-105 transition" id="play-btn">
<i class="fas fa-play text-sm"></i>
</button>
<button class="text-gray-400 hover:text-white text-xl" id="next-btn">
<i class="fas fa-step-forward"></i>
</button>
<button class="text-gray-400 hover:text-white text-lg" id="repeat-btn">
<i class="fas fa-redo"></i>
</button>
</div>
<div class="w-full flex items-center">
<span class="text-gray-400 text-xs mr-2" id="current-time">0:00</span>
<div class="flex-1 progress-bar">
<div class="progress-fill" id="progress-bar"></div>
</div>
<span class="text-gray-400 text-xs ml-2" id="duration">0:00</span>
</div>
</div>
<div class="w-1/4 flex items-center justify-end space-x-3">
<button class="text-gray-400 hover:text-white">
<i class="fas fa-list"></i>
</button>
<button class="text-gray-400 hover:text-white">
<i class="fas fa-desktop"></i>
</button>
<button class="text-gray-400 hover:text-white">
<i class="fas fa-volume-up"></i>
</button>
<div class="w-24">
<input type="range" min="0" max="100" value="70" class="volume-slider" id="volume-slider">
</div>
</div>
</div>
<!-- Audio Element (Hidden) -->
<audio id="audio-player"></audio>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Sample music data with base64 encoded short audio clips
const songs = [
{
title: "Blinding Lights",
artist: "The Weeknd",
album: "After Hours",
duration: "3:20",
dateAdded: "1 week ago",
audioSrc: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
albumArt: "https://i.scdn.co/image/ab67616d00001e02e1a6e2d3c6a0a3b5a0e6d3a1"
},
{
title: "Save Your Tears",
artist: "The Weeknd",
album: "After Hours",
duration: "3:35",
dateAdded: "2 weeks ago",
audioSrc: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3",
albumArt: "https://i.scdn.co/image/ab67616d00001e02e1a6e2d3c6a0a3b5a0e6d3a1"
},
{
title: "Levitating",
artist: "Dua Lipa",
album: "Future Nostalgia",
duration: "3:23",
dateAdded: "3 days ago",
audioSrc: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3",
albumArt: "https://i.scdn.co/image/ab67616d00001e02a3b5a0e6d3c6a0a3b5a0e6d3a1"
},
{
title: "Don't Start Now",
artist: "Dua Lipa",
album: "Future Nostalgia",
duration: "3:03",
dateAdded: "1 month ago",
audioSrc: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-4.mp3",
albumArt: "https://i.scdn.co/image/ab67616d00001e02a3b5a0e6d3c6a0a3b5a0e6d3a1"
},
{
title: "Watermelon Sugar",
artist: "Harry Styles",
album: "Fine Line",
duration: "2:54",
dateAdded: "2 months ago",
audioSrc: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-5.mp3",
albumArt: "https://i.scdn.co/image/ab67616d00001e02b5a0e6d3c6a0a3b5a0e6d3a1"
}
];
// DOM elements
const audioPlayer = document.getElementById('audio-player');
const playBtn = document.getElementById('play-btn');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const progressBar = document.getElementById('progress-bar');
const currentTimeDisplay = document.getElementById('current-time');
const durationDisplay = document.getElementById('duration');
const currentSongTitle = document.getElementById('current-song-title');
const currentSongArtist = document.getElementById('current-song-artist');
const currentAlbumImg = document.getElementById('current-album-img');
const currentAlbumArt = document.getElementById('current-album-art');
const volumeSlider = document.getElementById('volume-slider');
const playlistElement = document.getElementById('playlist');
const shuffleBtn = document.getElementById('shuffle-btn');
const repeatBtn = document.getElementById('repeat-btn');
// Player state
let currentSongIndex = 0;
let isPlaying = false;
let isShuffle = false;
let isRepeat = false;
// Initialize playlist
function renderPlaylist() {
playlistElement.innerHTML = '';
songs.forEach((song, index) => {
const tr = document.createElement('tr');
tr.className = `playlist-item h-12 hover:bg-gray-800 cursor-pointer ${index === currentSongIndex ? 'active' : ''}`;
tr.innerHTML = `
<td class="pl-2">${index + 1}</td>
<td>
<div class="flex items-center">
<div class="w-10 h-10 bg-gray-700 rounded mr-3">
<img src="${song.albumArt}" alt="${song.album}" class="w-full h-full object-cover rounded">
</div>
<div>
<div class="text-white text-sm font-medium">${song.title}</div>
<div class="text-gray-400 text-xs">${song.artist}</div>
</div>
</div>
</td>
<td class="text-sm">${song.album}</td>
<td class="text-sm">${song.dateAdded}</td>
<td class="pr-2 text-sm">${song.duration}</td>
`;
tr.addEventListener('click', () => {
playSong(index);
});
playlistElement.appendChild(tr);
});
}
// Play a song
function playSong(index) {
if (index >= 0 && index < songs.length) {
currentSongIndex = index;
const song = songs[currentSongIndex];
audioPlayer.src = song.audioSrc;
audioPlayer.play();
currentSongTitle.textContent = song.title;
currentSongArtist.textContent = song.artist;
currentAlbumImg.src = song.albumArt;
currentAlbumImg.alt = song.album;
// Update active song in playlist
const playlistItems = document.querySelectorAll('.playlist-item');
playlistItems.forEach((item, i) => {
if (i === index) {
item.classList.add('active');
} else {
item.classList.remove('active');
}
});
// Update play button
playBtn.innerHTML = '<i class="fas fa-pause text-sm"></i>';
isPlaying = true;
// Add playing animation to album art
currentAlbumArt.classList.add('playing');
}
}
// Toggle play/pause
function togglePlay() {
if (isPlaying) {
audioPlayer.pause();
playBtn.innerHTML = '<i class="fas fa-play text-sm"></i>';
currentAlbumArt.classList.remove('playing');
} else {
audioPlayer.play();
playBtn.innerHTML = '<i class="fas fa-pause text-sm"></i>';
currentAlbumArt.classList.add('playing');
}
isPlaying = !isPlaying;
}
// Play next song
function nextSong() {
if (isShuffle) {
currentSongIndex = Math.floor(Math.random() * songs.length);
} else {
currentSongIndex = (currentSongIndex + 1) % songs.length;
}
playSong(currentSongIndex);
}
// Play previous song
function prevSong() {
if (isShuffle) {
currentSongIndex = Math.floor(Math.random() * songs.length);
} else {
currentSongIndex = (currentSongIndex - 1 + songs.length) % songs.length;
}
playSong(currentSongIndex);
}
// Update progress bar
function updateProgress() {
const { currentTime, duration } = audioPlayer;
const progressPercent = (currentTime / duration) * 100;
progressBar.style.width = `${progressPercent}%`;
// Update time displays
currentTimeDisplay.textContent = formatTime(currentTime);
durationDisplay.textContent = formatTime(duration);
}
// Format time (seconds to MM:SS)
function formatTime(seconds) {
if (isNaN(seconds)) return '0:00';
const minutes = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${minutes}:${secs < 10 ? '0' : ''}${secs}`;
}
// Set progress when clicked on progress bar
function setProgress(e) {
const width = this.clientWidth;
const clickX = e.offsetX;
const duration = audioPlayer.duration;
audioPlayer.currentTime = (clickX / width) * duration;
}
// Event listeners
playBtn.addEventListener('click', togglePlay);
prevBtn.addEventListener('click', prevSong);
nextBtn.addEventListener('click', nextSong);
audioPlayer.addEventListener('timeupdate', updateProgress);
audioPlayer.addEventListener('ended', () => {
if (isRepeat) {
playSong(currentSongIndex);
} else {
nextSong();
}
});
audioPlayer.addEventListener('loadedmetadata', () => {
durationDisplay.textContent = formatTime(audioPlayer.duration);
});
document.querySelector('.progress-bar').addEventListener('click', function(e) {
const width = this.clientWidth;
const clickX = e.offsetX;
const duration = audioPlayer.duration;
audioPlayer.currentTime = (clickX / width) * duration;
});
volumeSlider.addEventListener('input', function() {
audioPlayer.volume = this.value / 100;
});
shuffleBtn.addEventListener('click', function() {
isShuffle = !isShuffle;
this.style.color = isShuffle ? '#1DB954' : '#B3B3B3';
});
repeatBtn.addEventListener('click', function() {
isRepeat = !isRepeat;
this.style.color = isRepeat ? '#1DB954' : '#B3B3B3';
});
// Initialize
renderPlaylist();
audioPlayer.volume = volumeSlider.value / 100;
// Play first song by default
playSong(0);
audioPlayer.pause();
isPlaying = false;
playBtn.innerHTML = '<i class="fas fa-play text-sm"></i>';
currentAlbumArt.classList.remove('playing');
});
</script>
<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=ztrem/spotify" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>