ACCOUSTIC dikit boleh dong!
*PART 2 of 2: SOURCE CODE



S O U R C E  C O D E

<div style="text-align: center; margin: 20px 0;">
  <a href="https://www.youtube.com/watch?v=qdVQXDDN2nw&list=RDqdVQXDDN2nw&start_radio=1" target="_blank" style="
    display: inline-block;
    padding: 12px 20px;
    background-color: #ff0000;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    border-radius: 6px;
    font-family: Arial, sans-serif;
    transition: 0.3s;
  " onmouseover="this.style.backgroundColor='#cc0000'" onmouseout="this.style.backgroundColor='#ff0000'">
    COPYRIGHT by GREEN DAY YOUTUBE-CHANNEL
  </a>
</div>
<hr>
<br>
<div id="ytAudioApp" style="text-align:center;font-family:Arial;margin:20px 0;">
  <div id="loadingBox" style="width:100%;max-width:320px;margin:10px auto;background:#eee;border-radius:10px;overflow:hidden;">
    <div id="loadingBar" style="width:10%;height:6px;background:#1db954;"></div>
  </div>

  <div style="margin:10px 0;">
    <button id="btnPlay" style="padding:8px 14px;margin:4px;">▶ Play</button>
    <button id="btnPause" style="padding:8px 14px;margin:4px;">⏸ Pause</button>
    <button id="btnLoop" style="padding:8px 14px;margin:4px;">🔁 OFF</button>
  </div>

  <div style="font-size:14px;">
    <span id="currentTime">0:00</span> / <span id="duration">0:00</span>
  </div>

  <div id="player" style="width:0;height:0;overflow:hidden;"></div>
</div>

<script>
// 1. Expose the global API ready function
window.onYouTubeIframeAPIReady = function() {
    initPlayer();
};

(function(){
  var player = null;
  var isReady = false;
  var isLoop = false;
  var timer = null;

  function $(id){ return document.getElementById(id); }

  function setBar(p){
    var el = $("loadingBar");
    if(el) el.style.width = p + "%";
  }

  function hideLoad(){
    var el = $("loadingBox");
    if(el) el.style.display = "none";
  }

  function format(sec){
    sec = Math.floor(sec || 0);
    var m = Math.floor(sec / 60);
    var s = sec % 60;
    return m + ":" + (s < 10 ? "0"+s : s);
  }

  window.initPlayer = function(){
    player = new YT.Player('player',{
      height:'0',
      width:'0',
      videoId:'qdVQXDDN2nw',
      playerVars:{ controls:0, rel:0, modestbranding:1 },
      events:{
        onReady:function(){
          isReady = true;
          hideLoad();
        },
        onStateChange:function(e){
          if(e.data === YT.PlayerState.PLAYING){
            timer = setInterval(function(){
              $("currentTime").innerHTML = format(player.getCurrentTime());
              $("duration").innerHTML = format(player.getDuration());
            }, 1000);
          } else {
            clearInterval(timer);
          }
          if(e.data === YT.PlayerState.ENDED && isLoop){
            player.seekTo(0);
            player.playVideo();
          }
        }
      }
    });
  }

  // Load API script
  var s = document.createElement("script");
  s.src = "https://www.youtube.com/iframe_api";
  document.head.appendChild(s);

  // Button Listeners
  $("btnPlay").onclick = function(){ if(isReady) player.playVideo(); };
  $("btnPause").onclick = function(){ if(isReady) player.pauseVideo(); };
  $("btnLoop").onclick = function(){
    isLoop = !isLoop;
    this.innerHTML = isLoop ? "🔁 ON" : "🔁 OFF";
  };
})();
</script>
<hr>
<div class='blogger-post-body' style='background:#fff; border-radius:8px; box-shadow:0 2px 5px rgba(0,0,0,0.1); font-family:Arial,Helvetica,sans-serif; font-size:16px; line-height:1.5; margin:0 auto; max-width:700px; padding:25px 30px;'>
  <h2 style='border-bottom:1px solid #eee; font-size:1.8rem; font-weight:normal; margin-bottom:0.2rem; padding-bottom:5px;'>
    "Espionage" – Green Day
  </h2>
  <div style='color:#555; font-size:0.9rem; margin-bottom:1.2rem; margin-top:0;'>
    Jan 26, 2017
  </div>
  <div style='font-style:italic; margin:0.5rem 0;'>
    From: <em>Austin Powers: The Spy Who Shagged Me (Soundtrack)</em>
  </div>
  <div style='color:#666; font-size:0.9rem; margin-top:0;'>
    ℗ 1997 Reprise Records
  </div>
  <div style='background:#fafafa; border-left:4px solid #3c8dbc; margin:1.5rem 0; padding:12px 18px;'>
    <p style='font-weight:bold; margin:0 0 8px;'>
      Credits (condensed):
    </p>
    <ul style='margin:0; padding-left:20px;'>
      <li style='margin:5px 0;'>Billie Joe Armstrong – guitar, lead vocals, writer, producer</li>
      <li style='margin:5px 0;'>Mike Dirnt – bass, backing vocals, writer, producer</li>
      <li style='margin:5px 0;'>Tré Cool – drums, writer, producer</li>
      <li style='margin:5px 0;'>Ken Allardyce – engineer, producer</li>
      <li style='margin:5px 0;'>Rob Cavallo – producer</li>
      <li style='margin:5px 0;'>Chris Lord-Alge – mixing engineer</li>
      <li style='margin:5px 0;'>Steve Hall – mastering engineer</li>
      <li style='margin:5px 0;'>Robert Vosgien – remastering engineer</li>
      <li style='margin:5px 0;'>Additional engineers – Barry Goldberg, Bill Kinsley, Mike Dy, Wes Seidman</li>
    </ul>
  </div>
  <div style='border-top:1px solid #ddd; color:#888; font-size:0.8rem; margin-top:20px; padding-top:12px; text-align:center;'>
    Auto-generated by YouTube
  </div>
</div>

Comments