Skip to content

Commit

Permalink
complete new project
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupankarsaha committed Jun 18, 2024
1 parent fc44787 commit c45fba6
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
Binary file not shown.
92 changes: 92 additions & 0 deletions root/assets/css/music-player.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
* {
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.container {
width: 100%;
height: 100vh;
background: #333;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
.music-player {
background: #ffe0e5;
width: 400px;
padding: 25px 35px;
text-align: center;
}
nav{
display: flex;
justify-content: space-between;
margin-bottom: 30px;
}
nav .circle{
border-radius: 50%;
width: 40px;
height: 40px;
line-height: 40px;
background: #fff;
color: #f53192;
box-shadow: 0 5px 10px rgba(255, 26, 26, 0.22);
}
.song-img{
width: 220px;
border-radius: 50%;
border: 8px solid #fff;
box-shadow: 0 10px 60px rgba(255, 26, 26, 0.22);
}
.music-player h1{
font-size: 20px;
font-weight: 400;
color: #333;
margin-top: 20px;
}
.music-player p{
font-size: 14px;
color: #333;
}
#progress{
-webkit-appearance: none;
width: 100%;
height: 6px;
background: #f53192;
border-radius: 4px;
cursor: pointer;
margin: 40px 0;
}
#progress::-webkit-slider-thumb{
-webkit-appearance: none;
background: #f53192;
width: 30px;
height: 30px;
border-radius: 50%;
border: 8px solid #fff;
box-shadow: 0 5px 5px rgba(255, 26, 26, 0.22);
}
.controls{
display: flex;
justify-content: center;
align-items: center;
}.controls div{
width: 60px;
height: 60px;
margin: 20px;
background: #fff;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
color: #f53192;
box-shadow: 0 10px 20px rgba(255, 26, 26, 0.22);
cursor: pointer;
}
.controls div:nth-child(2){
transform: scale(1.5);
background: #f53192;
color: #fff;

}
Binary file added root/assets/photo/despasito.jpg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions root/pages/music-player.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Music player Design - Rupankar Saha</title>
<link rel="stylesheet" href="/root/assets/css/music-player.css">
<script src="https://kit.fontawesome.com/800e70be9f.js" crossorigin="anonymous"></script>
</head>

<body>
<div class="container">
<div class="music-player">
<nav>
<div class="circle">
<i class="fa-solid fa-angle-left"></i>

</div>
<div class="circle">
<i class="fa-solid fa-bars"></i>
</div>
</nav>
<img src="/root/assets/photo/despasito.jpg.png" class="song-img">
<h1>Despacito</h1>
<p>Luis Fonsi Ft. puerto Rican</p>

<audio id="song">
<source src="/root/assets/WhatsApp Audio 2024-06-09 at 14.19.31_49753fb1.mp3"
type="audio/mpeg">
</audio>
<input type="range" value="0" id="progress">

<div class="controls">
<div><i class="fa-solid fa-backward"></i></div>
<div onclick="playPause()"><i class="fa-solid fa-play" id="ctrlIcon"></i></div>
<div> <i class="fa-solid fa-forward"></i></div>

</div>


</div>
</div>

<script>

let progress = document.getElementById("progress");
let song = document.getElementById("song");
let ctrlIcon = document.getElementById("ctrlIcon");

song.onloadedmetadata = function () {
progress.max = song.duration;
progress.value = song.currentTime;
}

function playPause() {
if (ctrlIcon.classList.contains("fa-pause")) {
song.pause();
ctrlIcon.classList.remove("fa-pause");
ctrlIcon.classList.add("fa-play");
}
else {
song.play();
ctrlIcon.classList.add("fa-pause");
ctrlIcon.classList.remove("fa-play");
}
}

if (song.play()) {
setInterval(() => {
progress.value = song.currentTime;
}, 500);
}
progress.onchange = function () {
song.play();
song.currentTime = progress.value;
ctrlIcon.classList.add("fa-pause");
ctrlIcon.classList.remove("fa-play");
}


</script>

</body>

</html>

0 comments on commit c45fba6

Please sign in to comment.