07/11: Current weight: 63kg           27/10: Ageha February 2007 is up!          17/10: Current weight: 63.2kg          16/10: Made a new about me page!          04/10: New Meiku Tutorial is up!!          03/10: Scanned ageha january 2007          03/10: Current Weight: 64.8kg          24/09: Current Weight: 65kg          22/09: Scanned Ageha December 2006 and uploaded it          08/09: Scanned Blenda March 2013 and uploaded it     05/09: Current weight: 65.8kg           01/09: I added "random posts" back on left sidebar     29/08: Current weight: 66kg    28/08: Added a page with my html codes

music box

 


Here is the code from my music box...insert anywhere in your layout with a html-widget.
The moving gif is a picture, the actual playlist is just the arrows with the heart:



<!-- Music Controls -->

<div id="yt-player-controls" style="text-align: center; font-family: monospace; font-size: 20px; margin-top: 10px;">  // size of the music box, since it's text
  <a href="javascript:void(0);" onclick="prevTrack()" id="prev" style="margin: 0 10px; color: black; text-decoration: none;"></a>
  <a href="javascript:void(0);" onclick="togglePlay()" id="playPause" style="margin: 0 10px; color: black; text-decoration: none;"></a>
  <a href="javascript:void(0);" onclick="nextTrack()" id="next" style="margin: 0 10px; color: black; text-decoration: none;"></a>
</div>

<!-- Hidden YouTube Player -->
<div id="yt-player" style="display: none;"></div>

<script>
  // Inject YouTube API script
  let tag = document.createElement('script');
  tag.src = "https://www.youtube.com/iframe_api";
  document.body.appendChild(tag);

  let player;
  let isPlaying = false;

  function onYouTubeIframeAPIReady() {
    player = new YT.Player('yt-player', {
      height: '0',
      width: '0',
      playerVars: {
        listType: 'playlist',
        list: 'INSERT PLAYLIST ID HERE', 
        autoplay: 1, // 1 means autoplay
        controls: 0
      },
      events: {
        'onReady': onPlayerReady
      }
    });
  }

  function onPlayerReady(event) {
    event.target.setVolume(50);
    event.target.playVideo();
    isPlaying = true;
    updateControls();
  }

  function togglePlay() {
    if (!player) return;
    if (isPlaying) {
      player.pauseVideo();
    } else {
      player.playVideo();
    }
    isPlaying = !isPlaying;
    updateControls();
  }

  function nextTrack() {
    if (player) player.nextVideo();
  }

  function prevTrack() {
    if (player) player.previousVideo();
  }

  function updateControls() {
    document.getElementById("prev").innerHTML = "◁";
    document.getElementById("playPause").innerHTML = isPlaying ? "♡" : "♫";
    document.getElementById("next").innerHTML = "▷";
  } //Change here the symbols of your music box if you want different symbols
</script>


You can find the ID of the youtube playlist in the link.

Example: 


I opened a random playlist now.
In this case the ID is after list= and is called RDzd4ONUviSQY

You can make your own playlist on YT and use the ID for it.


0 件のコメント:

コメントを投稿