Simple music player. Inspired by Paul Flavius Nechita on dribbble : https://dribbble.com/shots/2132841-Day-005-Music-Player.
Created
October 27, 2022 21:39
-
-
Save umhiru/9203aa036a333271517211cdf391268d to your computer and use it in GitHub Desktop.
Flat music player
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Flat music player</title> | |
</head> | |
<body> | |
<div class="contain"> | |
<div class="container"> | |
<div class="music-player"> | |
<div class="cover"> | |
<img src="https://mariongrandvincent.github.io/HTML-Personal-website/img-codePen/kygo.png" alt=""> | |
</div> | |
<div class="titre"> | |
<h3>Kygo</h3> | |
<h1>Stole the show</h1> | |
</div> | |
<div class="lecteur"> | |
<audio style="width: 100%;" class="fc-media"> | |
<source src="https://mariongrandvincent.github.io/HTML-Personal-website/img-codePen/kygo-stole-the-show.mp3" type="audio/mp3"/> | |
</audio> | |
</div> | |
</div> | |
</div> | |
</div> | |
</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
var audio = { | |
init: function() { | |
var $that = this; | |
$(function() { | |
$that.components.media(); | |
}); | |
}, | |
components: { | |
media: function(target) { | |
var media = $('audio.fc-media', (target !== undefined) ? target : 'body'); | |
if (media.length) { | |
media.mediaelementplayer({ | |
audioHeight: 40, | |
features : ['playpause', 'current', 'duration', 'progress', 'volume', 'tracks', 'fullscreen'], | |
alwaysShowControls : true, | |
timeAndDurationSeparator: '<span></span>', | |
iPadUseNativeControls: true, | |
iPhoneUseNativeControls: true, | |
AndroidUseNativeControls: true | |
}); | |
} | |
}, | |
}, | |
}; | |
audio.init(); |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/4.2.7/mediaelement-and-player.min.js"></script> |
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
*:focus{ | |
outline: none; | |
} | |
html { | |
background: #f2f2f2; | |
} | |
body { | |
margin: 0; | |
font-family: "Raleway",sans-serif; | |
} | |
h1 { | |
margin: 0; | |
font-size: 33px; | |
color: #fff; | |
padding: 0 10%; | |
} | |
h3 { | |
margin: 0; | |
font-size: 17px; | |
font-weight: 500; | |
color: #ccc; | |
padding: 0 10%; | |
} | |
.container { | |
display: block; | |
width: 100%; | |
height: 750px; | |
margin: auto; | |
overflow: hidden; | |
background-image: url("https://mariongrandvincent.github.io/HTML-Personal-website/img-codePen/bg-music-player.jpg"); | |
background-repeat: repeat; | |
background-size: cover; | |
} | |
.music-player { | |
display: block; | |
position: relative; | |
width: 400px; | |
height: 570px; | |
margin: auto; | |
margin-top: 6%; | |
border-radius: 0 0 10px 10px; | |
background: transparent linear-gradient(to bottom,rgba(10,11,31,0.9) 50%,rgb(10,11,31) 70%) repeat scroll 0 0; | |
box-shadow: 1px 10px 20px 5px #222; | |
} | |
.cover { | |
float: left; | |
width: 100%; | |
height: 66%; | |
} | |
.cover img { | |
display: block; | |
position: absolute; | |
top: 8%; | |
left: 14%; | |
width: 70%; | |
margin: auto; | |
text-align: center; | |
} | |
.titre { | |
float: left; | |
width: 100%; | |
} | |
.lecteur { | |
width: 100%; | |
display: block; | |
height: auto; | |
position: relative; | |
float: left; | |
} | |
.mejs__button>button:focus { | |
outline: 0px dotted #999; | |
} | |
.mejs__container { | |
position: relative; | |
background-color: transparent; | |
min-width: auto !important; | |
} | |
.mejs__controls { | |
padding: 0 10%; | |
background: transparent !important; | |
display: block; | |
position: relative; | |
} | |
.mejs__controls div { | |
display: block; | |
float: left; | |
position: relative; | |
} | |
.mejs__controls .mejs__playpause-button { | |
position: absolute !important; | |
right: 8%; | |
bottom: 95%; | |
width: 40px; | |
} | |
.mejs__controls .mejs__playpause-button button { | |
display: block; | |
width: 40px; | |
height: 40px; | |
padding: 0; | |
border: 0; | |
font-family: FontAwesome; | |
font-size: 23px; | |
color: #5bbb95; | |
background: transparent; | |
padding: 0; | |
margin: 0; | |
} | |
.mejs__controls .mejs__play button:before{ | |
content:"\f04b"; | |
} | |
.mejs__controls .mejs__pause button:before{ | |
content:"\f04c"; | |
} | |
.mejs__controls .mejs__volume-button button { | |
display: block; | |
width: 40px; | |
height: 40px; | |
padding: 0; | |
border: 0; | |
font-family: FontAwesome; | |
font-size: 20px; | |
color: #5bbb95; | |
background: transparent; | |
margin: 0; | |
padding: 0; | |
} | |
.mejs__controls .mejs__mute button:before { | |
content: "\f028"; | |
} | |
.mejs__controls .mejs__unmute button:before { | |
content: "\f026"; | |
} | |
.mejs__controls .mejs__time { | |
width: 100%; | |
margin-top: 7%; | |
margin-bottom: 3%; | |
color: #fff; | |
height: auto; | |
padding: 0; | |
overflow: visible; | |
min-width: 100%; | |
} | |
.mejs__controls .mejs__time span { | |
font-size: 15px; | |
} | |
.mejs__controls span.mejs__duration { | |
float: right; | |
text-align: right; | |
color: #ccc; | |
} | |
.mejs__controls span.mejs__currenttime { | |
font-weight: 700; | |
float: left; | |
} | |
.mejs__controls .mejs__time-rail { | |
width: 100%; | |
margin: 0; | |
} | |
.mejs__controls .mejs__time-rail span { | |
position: absolute; | |
top: 0; | |
width: 100%; | |
height: 4px; | |
border-radius: 50px; | |
cursor: pointer; | |
} | |
.mejs__controls .mejs__time-rail .mejs__time-loaded { | |
background: rgba(255,255,255,0.2); | |
} | |
.mejs__controls .mejs__time-rail .mejs__time-float { | |
display: none; | |
top: -40px; | |
width: 40px; | |
height: 25px; | |
margin-left: 0px; | |
text-align: center; | |
font-size: 10px; | |
background: #fff; | |
border: 0; | |
} | |
.mejs__controls .mejs__time-rail .mejs__time-float-current { | |
display: block; | |
position: relative; | |
top: 0; | |
margin: 0; | |
line-height: 26px; | |
color: #100d28; | |
} | |
.mejs__controls .mejs__time-rail .mejs__time-float-corner { | |
top: auto; | |
bottom: -9px; | |
left: 50%; | |
width: 0; | |
height: 0; | |
border-top: 6px solid #fff; | |
border-right: 6px solid transparent; | |
border-left: 6px solid transparent; | |
} | |
.mejs__controls .mejs__time-rail .mejs__time-current { | |
background: #5BBB95 none repeat scroll 0 0; | |
} | |
.mejs__controls .mejs__time-handle { | |
display: none; | |
} | |
.mejs__controls .mejs__volume-button { | |
position: relative; | |
position: absolute !important; | |
top: 70px; | |
right: 25%; | |
width: 40px; | |
height: 40px; | |
} | |
.mejs__controls .mejs__horizontal-volume-slider { | |
display: block; | |
position: absolute !important; | |
position: relative; | |
top: 70px; | |
right: 10%; | |
width: 60px; | |
height: 4px; | |
margin-top: 18px; | |
border-radius: 50px; | |
line-height: 11px; | |
} | |
.mejs__controls .mejs__horizontal-volume-slider .mejs__horizontal-volume-total, | |
.mejs__controls .mejs__horizontal-volume-slider .mejs__horizontal-volume-current { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
background: rgba(255,255,255,0.1); | |
} | |
.mejs__controls .mejs__horizontal-volume-slider .mejs__horizontal-volume-current { | |
background: #fff; | |
} |
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
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" /> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/4.2.7/mediaelementplayer.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment