-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25e7228
commit d42cc6d
Showing
25 changed files
with
332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Spotify - Your favourite music is here</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
|
||
<nav> | ||
<ul> | ||
<li class="brand"><img src="logo.png" alt="Spotify">Spotify</li> | ||
<li>Home</li> | ||
<li>About</li> | ||
</ul> | ||
</nav> | ||
|
||
<div class="container"> | ||
<div class="songList"> | ||
<h1>Best of NCS - No Copyright Sounds</h1> | ||
</div class="songItemContainer" > | ||
<div> | ||
<div class="songItem"> | ||
<img src="1.jpg" alt="1" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">03:50 <i id= "0" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="2.jpg" alt="2" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">02:33 <i id= "1" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="3.jpg" alt="3" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">04:33 <i id= "2" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="4.jpg" alt="4" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">04:27 <i id= "3" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="5.jpg" alt="5" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">03:28 <i id= "4" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="6.jpg" alt="6" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">03:28 <i id= "5" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="7.jpg" alt="7" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">04:33 <i id= "6" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="8.jpg" alt="8" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">03:50 <i id= "7" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="9.jpg" alt="9" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">03:28 <i id= "8" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
<div class="songItem"> | ||
<img src="10.jpg" alt="10" > | ||
<span class="songName">Let me Love You</span> | ||
<span class="songlistplay"><span class="timestamp">04:27 <i id= "9" class="fa-regular songItemPlay fa-2x fa-play-circle"></i></span></span> | ||
</div> | ||
|
||
</div> | ||
<div class="songBanner"></div> | ||
</div> | ||
|
||
|
||
<div class="bottom"> | ||
<input type="range" name="range" id="myProgressBar" min="0" value="0" max="100"> | ||
<div class="icons"> | ||
<!-- fontawesome icons --> | ||
<i class="fa-solid fa-3x fa-backward-step" id="previous"></i> | ||
<i class="fa-regular fa-3x fa-play-circle" id = "masterPlay"></i> | ||
<i class="fa-solid fa-3x fa-forward-step" id="next"></i> | ||
</div> | ||
<div class="songInfo"> | ||
<img src="playing.gif" width="42px" alt="" id="gif"> <span id="masterSongName">Warriyo - Mortals [NCS Release]</span> | ||
</div> | ||
</div> | ||
|
||
<script src="https://kit.fontawesome.com/5e848eb8a3.js" crossorigin="anonymous"></script> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
console.log("Welcome to Spotify"); | ||
|
||
//Initialize the variables | ||
let songIndex = 0; | ||
let audioElement = new Audio('songs/1.mp3'); | ||
let masterPlay = document.getElementById('masterPlay'); | ||
let myProgressBar = document.getElementById('myProgressBar'); | ||
let gif = document.getElementById('gif'); | ||
let masterSongName = document.getElementById('masterSongName'); | ||
let songItems =Array.from(document.getElementsByClassName('songItem')); | ||
|
||
let songs = [ | ||
{songName: "Warriyo - Mortals [NCS Release]" , filePath: "songs/1.mp3" , coverPath: "1.jpg"}, | ||
{songName: "Cielo - Hum-Huma" , filePath: "songs/2.mp3" , coverPath: "2.jpg"}, | ||
{songName: "DEAF KEV - Invincible [NCS Release]-320k" , filePath: "songs/3.mp3" , coverPath: "3.jpg"}, | ||
{songName: "Different Heaven & EH!DE - My Heart" , filePath: "songs/4.mp3" , coverPath: "4.jpg"}, | ||
{songName: "Janji-Heroes-Tonight-feat-Johnning-NCS-Release" , filePath: "songs/5.mp3" , coverPath: "5.jpg"}, | ||
{songName: "Rabba " , filePath: "songs/6.mp3" , coverPath: "6.jpg"}, | ||
{songName: "Sakhiyaan" , filePath: "songs/7.mp3" , coverPath: "7.jpg"}, | ||
{songName: "Bhula Dena" , filePath: "songs/8.mp3" , coverPath: "8.jpg"}, | ||
{songName: "Tumhari Kasam" , filePath: "songs/9.mp3" , coverPath: "9.jpg"}, | ||
{songName: "Na Jaana" , filePath: "songs/10.mp3" , coverPath: "10.jpg"}, | ||
] | ||
|
||
songItems.forEach((element, i)=>{ | ||
element.getElementsByTagName("img")[0].src = songs[i].coverPath; | ||
element.getElementsByClassName("songName")[0].innerText = songs[i].songName; | ||
}) | ||
|
||
// audioElement.play(); | ||
|
||
//Handle play/pause click | ||
|
||
masterPlay.addEventListener('click', ()=>{ | ||
if(audioElement.paused || audioElement.currentTime<=0){ | ||
audioElement.play(); | ||
masterPlay.classList.remove('fa-play-circle'); | ||
masterPlay.classList.add('fa-pause-circle'); | ||
gif.style.opacity = 1; | ||
} | ||
else{ | ||
audioElement.pause(); | ||
masterPlay.classList.remove('fa-pause-circle'); | ||
masterPlay.classList.add('fa-play-circle'); | ||
gif.style.opacity = 0; | ||
} | ||
}) | ||
|
||
//Listen to events | ||
audioElement.addEventListener('timeupdate' , ()=>{ | ||
//Update Seekbar | ||
progress = parseInt((audioElement.currentTime/audioElement.duration)*100); | ||
myProgressBar.value = progress; | ||
}) | ||
|
||
myProgressBar.addEventListener('change' , ()=>{ | ||
audioElement.currentTime = (myProgressBar.value * audioElement.duration)/100 | ||
}) | ||
|
||
const makeAllPlays = ()=>{ | ||
Array.from(document.getElementsByClassName('songItemPlay')).forEach((element)=>{ | ||
element.classList.add('fa-play-circle'); | ||
element.classList.remove('fa-pause-circle'); | ||
}) | ||
} | ||
|
||
Array.from(document.getElementsByClassName('songItemPlay')).forEach((element)=>{ | ||
element.addEventListener('click' , (e)=>{ | ||
makeAllPlays(); | ||
songIndex = parseInt(e.target.id); | ||
e.target.classList.remove('fa-play-circle'); | ||
e.target.classList.add('fa-pause-circle'); | ||
masterSongName.innerText = songs[songIndex].songName; | ||
audioElement.src = 'songs/{songIndex+1}.mp3'; | ||
audioElement.currentTime = 0; | ||
audioElement.play(); | ||
gif.style.opacity = 1; | ||
masterPlay.classList.remove('fa-play-circle'); | ||
masterPlay.classList.add('fa-pause-circle'); | ||
}) | ||
}) | ||
|
||
document.getElementById('next').addEventListener('click' , ()=>{ | ||
if(songIndex>=9){ | ||
songIndex = 0; | ||
} | ||
else{ | ||
songIndex += 1; | ||
} | ||
audioElement.src = 'songs/${songIndex+1}.mp3'; | ||
masterSongName.innerText = songs[songIndex].songName; | ||
audioElement.currentTime = 0; | ||
audioElement.play(); | ||
masterPlay.classList.remove('fa-play-circle'); | ||
masterPlay.classList.add('fa-pause-circle'); | ||
}) | ||
|
||
|
||
document.getElementById('previous').addEventListener('click' , ()=>{ | ||
if(songIndex<=0){ | ||
songIndex = 0; | ||
} | ||
else{ | ||
songIndex -= 1; | ||
} | ||
audioElement.src = 'songs/${songIndex+1}.mp3'; | ||
masterSongName.innerText = songs[songIndex].songName; | ||
audioElement.currentTime = 0; | ||
audioElement.play(); | ||
masterPlay.classList.remove('fa-play-circle'); | ||
masterPlay.classList.add('fa-pause-circle'); | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300&display=swap'); | ||
@import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap'); | ||
body { | ||
background-color: antiquewhite; | ||
} | ||
|
||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
nav{ | ||
font-family: 'Ubuntu', sans-serif ; | ||
} | ||
|
||
nav ul{ | ||
display: flex; | ||
align-items: center; | ||
list-style-type: none; | ||
height: 65px; | ||
background-color:black; | ||
color: white; | ||
} | ||
|
||
nav ul li{ | ||
padding: 0 12px; | ||
} | ||
|
||
.brand img{ | ||
width: 16px; | ||
padding: 0.8px; | ||
} | ||
|
||
.brand{ | ||
display: flex; | ||
align-items: center; | ||
font-weight: bolder; | ||
font-size: 1.3rem; | ||
} | ||
|
||
.container{ | ||
min-height: 45vh; | ||
background-color: black; | ||
color: white; | ||
font-family: 'Varela Round', sans-serif; | ||
display: flex; | ||
margin: 23px; | ||
width: 90%; | ||
border-radius: 12px; | ||
padding: 34px; | ||
background-image: url('bg.jpg'); | ||
} | ||
|
||
.bottom{ | ||
position: sticky; | ||
height: 130px; | ||
background-color: black; | ||
color: white; | ||
bottom: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
margin: 12px 0; | ||
} | ||
|
||
.icons{ | ||
margin-top: 4px; | ||
} | ||
|
||
.icons i{ | ||
cursor: pointer; | ||
} | ||
|
||
#myProgressBar{ | ||
width: 80vw; | ||
text-align: center; | ||
cursor: pointer; | ||
} | ||
|
||
.songItemContainer{ | ||
margin-top: 74px; | ||
} | ||
|
||
.songItem{ | ||
height: 50px; | ||
display: flex; | ||
background-color: white; | ||
|
||
color: black; | ||
margin: 12px 0; | ||
justify-content: space-between; | ||
align-items: center; | ||
border-radius: 34px; | ||
} | ||
|
||
.songItem img{ | ||
width: 43px; | ||
margin: 0 23px ; | ||
border-radius: 34px; | ||
|
||
} | ||
|
||
.timestamp{ | ||
margin: 0 23px; | ||
} | ||
|
||
.timestamp i{ | ||
cursor: pointer; | ||
} | ||
|
||
|
||
.songInfo{ | ||
position: absolute; | ||
left: 10vw; | ||
font-family: 'Varela Round', sans-serif; | ||
} | ||
|
||
.songInfo img{ | ||
opacity: 0; | ||
transition: opacity 0.4s ease-in; | ||
} |