function updateVideoTags(sessionLinks, noteLinks) {
  const sessionIconsContainers = document.querySelectorAll(
    '.session-icons-container'
  );
  const sessionVideos = document.querySelectorAll('.session-video');
  const sessionNotes = document.querySelectorAll('.session-note'); //
  const videoPlayers = new Array(sessionLinks.length).fill(null); // Array to store YouTube players
  const notePlayers = new Array(noteLinks.length).fill(null);

  // Function to create a new YouTube player with a given video ID
  function createYouTubePlayer(videoId, index) {
    if (!videoPlayers[index]) {
      videoPlayers[index] = new YT.Player(`player${index}`, {
        height: '515',
        width: '960',
        videoId: videoId,
        playerVars: {
          showinfo: 0, // Hide video title and uploader
          modestbranding: 1, // Minimal YouTube branding
          rel: 0, // Hide related videos at the end
        },
        events: {
          onReady: onPlayerReady,
        },
      });
    }
  }

  // Function to handle the "onReady" event for the YouTube player
  function onPlayerReady(event) {
    // Player is ready, but pause the video immediately
    event.target.pauseVideo();
  }

  sessionIconsContainers.forEach((container, index) => {
    const videoLink = container.querySelector('.video-icon');
    videoLink.addEventListener('click', function (e) {
      e.preventDefault();

      // Set the YouTube video ID based on the sessionLinks array
      const videoId = getYouTubeVideoId(sessionLinks[index]);
      if (videoId) {
        createYouTubePlayer(videoId, index);
      }

      // Toggle the visibility and play/pause of the video
      const sessionVideo = sessionVideos[index];
      if (sessionVideo.style.display === 'block') {
        sessionVideo.style.display = 'none';
        players[index].pauseVideo();
      } else {
        sessionVideo.style.display = 'block';
        players[index].playVideo();
      }
    });

    const noteLink = container.querySelector('.notes-icon');
    noteLink.addEventListener('click', function (e) {
      e.preventDefault();

      const videoId = getYouTubeVideoId(noteLinks[index]);
      if (videoId) {
        createYouTubePlayer(videoId, index);
      }

      // Toggle the visibility of the notes
      const sessionNote = sessionNotes[index];
      if (sessionNote.style.display === 'block') {
        sessionNote.style.display = 'none';
      } else {
        sessionNote.style.display = 'block';
      }
    });
  });
}
 <li class="sessions-li">
            <div class="session-container">
              <span class="session-number">S0</span>
              <span class="session-title"
                >Fundamentos de la Energía e Ingeniería de Hábitos</span
              >
            </div>
            <div class="session-icons-container">
              <a id="s0-video-href" href="#" data-session-index="0">
                <ion-icon class="video-icon" name="videocam-outline"></ion-icon>
              </a>
              <a id="s0-note-href" href="#" data-session-index="0"
                ><ion-icon class="notes-icon" name="document-outline"></ion-icon
              ></a>
              <span class="status-icon done">Done</span>
            </div>
          </li>
          <div class="session-video">
            <div id="player0"></div>
          </div>
I have an error on this function, the notes part is not working