cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <span class="song-loader"></span>
<h5>Please wait.. <br/>while song is loading..</h5>

<div class="wrapper">
  <div class="music music-cover">
    <img src="https://s5.postimg.cc/o9ar6qprb/Kaabil_Movie_Poster.jpg" alt="" class="cover-img" />
  </div>
  <div class="music album-controls">
    <img src="https://s5.postimg.cc/o9ar6qprb/Kaabil_Movie_Poster.jpg" alt="" class="album-img" />
    <div class="album-info">
      <span class="album-title">Kaabil</span>
      <span class="song-title">Kaabil Hoon</span>
      <span class="song-utility">
        <i class="fa fa-home" aria-hidden="true"></i>
        <i class="fa fa-random" aria-hidden="true"></i>
        <i class="fa fa-retweet" aria-hidden="true"></i>
        <i class="fa fa-clock-o" aria-hidden="true"></i>
      </span>
    </div>
  </div>
  <div class="music music-controls">
    <span class="seek-bar">
      <span class="knot"></span>
    </span>
    <span class="song-buffer"></span>
    <span class="song-current-time">00:00</span><span class="play">
    <i class="fa fa-play" aria-hidden="true"></i>
    <span class="song-duration">00:00</span>
    </span>
  </div>
</div>
<audio controls id="music-player" preload="auto">
  <source src="https://fahuvixagi.000webhostapp.com/Kaabil%20Hoon.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

<div class="credit">
  Inspired By
  <a target="_blank" href="https://dribbble.com/shots/2597693-Cassette-MiniPlayer">
    <img src="https://s5.postimg.cc/xkc92q4rr/Logo.png" alt="Dribbble Logo" class="d-logo" />
  </a>
</div>

<!--
  Song 1 :- http://searchandhra.in/hindi/Airlift/Soch%20Na%20Sake.mp3

  Ringtone :-
http://www.darksidev2.com/ringtone/Paradise%20City.mp3
-->
            
          
!
            
              *{
  margin:0;
  padding:0;
  outline:0;
}

body{
  background:#05d4bd;
  font-family:Verdana;
}

div.wrapper{
  position:relative;
  width:450px;
  height:530px;
  margin:0 auto;
  box-shadow:0px 80px 35px -40px rgba(84,75,33,0.4);
  transform-origin:top center;
  /*transform:translateY(-570px);*/
}

.showMP1{
  animation: showMusicPlayer 1000ms 300ms ease-in-out forwards;
}

h5{
  position:absolute;
  left:50%;
  text-align:center;
  margin-left:-60px;
  margin-top:200px;
  font-size:10px;
  color:rgba(0,0,0,1);
  animation:pw 900ms ease-in-out infinite;
}

@keyframes pw{
  0%,100%{
    opacity:1;
  }
  70%{
    opacity:0.7;
  }
}

@keyframes showMusicPlayer{
  0%{
    transform:translateY(-550px);
  }
  80%{
    transform:translateY(10px);
  }
  100%{
    transform:translateY(0px);
  }
}

.song-loader{
  position:absolute;
  width:4px;
  height:70px;
  background:#a26c37;
  display:inline-block;
  left:50%;
  top:120px;
  margin-left:-2px;
  opacity:1;
  animation:dancingBars 1000ms ease-in infinite;
}

.song-loader-anim{
  animation:dancingBars 1000ms ease-in infinite;
}

.song-loader:after,.song-loader:before{
  position:absolute;
  content:'';
  width:4px;
  height:70px;
  background:#a26c37;
  display:inline-block;
}

.song-loader:after{
  margin-left:10px;
  animation:dancingBars 900ms 500ms ease-in infinite;
}

.song-loader:before{
  margin-left:-10px;
  background:#a26c37;
  animation:dancingBars 700ms 100ms ease-in infinite;
}

@keyframes dancingBars{
  0%,100%{
    transform:scaleY(1);
    opacity:1;
  }
  50%{
    transform:scaleY(0.2);
    opacity:0.4;
  }
  80%{
    transform:scaleY(1.2);
    opacity:0.9;
  }
}

div.wrapper:after{
  position:absolute;
  content:'';
  width:95%;
  height:15px;
  background:rgba(0, 55, 49, 0.81);
  display:block;
  left:2.5%;
  bottom:-37px;
  border-radius:100%;
  -webkit-filter:blur(2px);
  -moz-filter:blur(2px);
  -ms-filter:blur(2px);
  filter:blur(2px);
  /*box-shadow:0px 20px 8px 7px rgba(112,79,122,0.4);*/
  z-index:-1;
}

.music-cover{
  height:42.5%;
  background:#003731;
  box-shadow:inset 0px 0px 225px rgba(0,0,0,0.3);
  text-align:center;
  overflow:hidden;
}

.cover-img{
  width:395px;
  margin-top:30px;
  border-radius:8px;
  border-top:2px solid  rgba(255,255,255,0.4);
  opacity:0.9;
}

.album-controls{
  position:relative;
  height:42.5%;
  background:#003731;
  border-top:2px solid rgba(255,255,255,0.2);
  text-align:center;
  overflow:hidden;
  box-shadow:inset 0px 0px 215px 50px #016a5f;
}

.album-img{
  width:395px;
  margin-top:-195px;
  border-radius:8px;
  border-top:2px solid  rgba(255,255,255,0.4);
  -webkit-filter:blur(16px);
  -moz-filter:blur(16px);
  -ms-filter:blur(16px);
  filter:blur(16px);
}

.album-info{
  position:absolute;
  width:100%;
  background:transparent;
  top:0;
}

.album-info span{
  width:100%;
  display:block;
  text-align:center;
  background:transparent;
  text-transform:uppercase;
}

span.album-title{
  color:#fff;
  font-size:19px;
  font-weight:bold;
  margin-top:45px;
}

span.song-title{
  font-size:18px;
  margin-top:21px;
  color:rgba(255,255,255,1);
}

.song-utility{
  margin-top:25px;
}

span .fa{
  color:rgba(255,255,255,0.7);
  background:transparent;
  padding:10px 20px;
  font-size:35px;
  margin:0 10px;
}

span .fa-retweet, span .fa-home{
  color:rgba(255,255,255,1);
}

.music-controls{
  position:relative;
  height:20%;
  background:rgba(255,255,255,1);
  border-radius:0px 0px 14px 14px;
  box-shadow:inset 0px -55px 15px -50px #c0bf99;
  /*overflow:hidden;*/
}

.music-controls > span{
  display:block;
  height:100%;
  float:left;
  text-align:center;
  background:#fff;
  line-height:580%;
  transition:all 0.3s linear;
}

.music-controls .seek-bar, .music-controls:before{
  position:absolute;
  width:100%;
  height:7px;
  content:'';
  display:block;
  clear:both;
  border-bottom:1px solid rgba(0,0,0,0.2);
}

.music-controls .seek-bar{
  width:0%;
  height:3px;
  top:1.5px;
  background:#003731;
}

.music-controls .song-buffer{
  position:absolute;
  display:inline-block;
  width:0%;
  height:3px;
  top:2px;
  left:0;
  background:#003731;
  opacity:0.4;
}


.music-controls:before{
  background:rgba(255,255,255,1);
}

.knot{
  position:absolute;
  z-index:99;
  top:-6px;
  right:-8px;
  width:8px;
  height:8px;
  background:#fff;
  border-radius:100%;
  border:4px solid #003731;
  display:inline-block;
  box-shadow:1px 1px 2px rgba(0,0,0,0.4);
  transition:all 300ms ease-in-out;
  opacity:1;
}

.music-controls span.song-current-time{
  width:30%;
  font-size:18px;
  color:#003731;
  border-radius:0 0 0 14px;
  opacity:0;
  transition:opacity 200ms ease-in;
}

.music-controls span.song-duration{
  opacity:0;
  transition:opacity 200ms ease-in;
}

.music-controls span.play{
  width:70%;
  font-size:18px;
  box-shadow:inset 100px 55px 200px -50px rgba(0,55,94,0.3);
  text-align:left;
  border-radius:0 0 14px 0;
}


.music-controls span.play:hover{
  box-shadow:inset 100px 55px 200px -50px rgba(0,55,94,0.4);
}

.fa-play, .fa-pause{
  position:relative;
  color:#003731 !important;
  top:6px;
  left:45px;
  transition:all 0.3s linear;
  cursor:default;
  pointer-events:none;
  opacity:0;
  transition:opacity 300ms ease-in;
}

.fa-play:hover, .fa-pause:hover{
  color:#003731 !important;
}

.music-controls span.song-duration{
  position:absolute;
  font-size:18px;
  background:transparent;
  color:#003731;
  right:40px;
}

#music-player{
  opacity:0;
  position:absolute;
  top:-100px;
}

.is-animate {
  transition:width 300ms linear;
}


div.credit {
  position: absolute;
  padding: 0px 10px;
  padding-bottom: 8px;
  height: 15px;
  right: 5px;
  top: 5px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  font-size: 7px;
  font-weight: bold;
  color: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0px 10px 15px -15px rgba(0, 0, 0, 0.3);
  cursor: default;
}

div.credit:hover{
  border: 1px solid rgba(0, 0, 0, 0.2);
}

div.credit img {
  position: relative;
  width: 14px;
  margin-left: 3px;
  top: 4px;
}
            
          
!
            
              var _audio = $("#music-player")[0],
  _audioDuration = 0,
  _currentTime = 0,
  _buffered = 0,
  _buuferPlayTime = 5;

$(".music-controls .fa").on("click", function() {
  var $this = $(this);
  $(".music-controls .seek-bar").css("animation-play-state", "running");
  if ($this.hasClass("fa-play")) {
    $this.removeClass("fa-play").addClass("fa-pause");
    _audio.play();
    $(".music-controls .seek-bar").addClass("is-animate");
  } else {
    $(".music-controls .seek-bar").css("animation-play-state", "paused");
    $this.removeClass("fa-pause").addClass("fa-play");
    $(".music-controls .seek-bar");
    _audio.pause();
  }
});

var _setAudioDuration = setInterval(function() {
  _audioDuration = _audio.duration;
  if (_audioDuration > 0) {
    $(".song-duration").html(formatAudio(_audioDuration)).css("opacity", 1);
    $(".song-current-time").css("opacity", 1);
    clearInterval(_setAudioDuration);
  }
}, 500);

var _animateSeek = setInterval(function() {
  if ($(".fa").hasClass("fa-pause")) {
    var _percent = (_audio.currentTime * 100) / _audioDuration;
    $(".is-animate").css("width", _percent + "%");
    
    $(".song-current-time").html(currentTime(_audio.currentTime));
  }
}, 500);

_audio.onended = function() {
  setTimeout(function() {
    _audio.currentTime = 0;
    $(".song-current-time").html(currentTime(_audio.currentTime));
    $(".is-animate").css("width", "0%");
    
    $(".music-controls .fa").removeClass("fa-pause").addClass("fa-play");
  }, 500);
};

var _checkBuffer = setInterval(function() {
  if (_audioDuration > 0) {
    _buffered = (_audio.buffered.end(_audio.buffered.length - 1) * 100) / _audio.duration;

    $(".music-controls .song-buffer").css("width", _buffered + "%");
    if (_buffered > _buuferPlayTime) {
      $(".wrapper").addClass("showMP");
      $(".fa").css({
        "opacity": "1",
        "pointer-events": "auto"
      });
    }
    if (_buffered == 100) {
      clearInterval(_checkBuffer);
    }
  }
}, 500);

function currentTime(songActivity){
  var _mprefix = "";
  var _sprefix = "";
  var _secs = songActivity;
  var _min = Math.floor(_secs/60);

  var _time = Math.floor(((_secs/60) - _min )*60);
  if(_min < 10){
    _mprefix = "0";
  }
  if(_time < 10){
    _sprefix = "0";
  }
  return _mprefix + _min + ":" + _sprefix + _time;
}

function formatAudio(songActivity) {
  var _mprefix = "",
    _sprefix = "",
    _secs = songActivity,
    _min = Math.floor(_secs / 60),
    _time = Math.floor(((_secs / 60) - _min) * 60);

  if (_min < 10) {
    _mprefix = "0";
  }
  if (_time < 10) {
    _sprefix = "0";
  }
  return _mprefix + _min + ":" + _sprefix + _time;
}




  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-109680738-1');

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console