В плеере (audio player) Кнопка play не работает, прогресс-бар не работает. Элементы плеера должны быть скрыты до тех пор на них не будет наведен курсор на карточку/обложку

index:
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta content="width=device-width, initial-scale=1.0" name="viewport">
	<meta content="ie=edge" http-equiv="X-UA-Compatible">
	<script src="/jquery/dist/jquery.min.js"></script>
    <script src="/jquery-ui/dist/jquery-ui.min.js"></script>
	<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
	<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
	<link href="/css/main.css" rel="stylesheet">
	<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
	<link href="/jquery-ui/themes/base/all.css" rel="stylesheet">
	
	<title>Home</title>
</head>
<body>
	<header class="header">
		<nav class="navbar navbar-expand-lg navbar-light bg-light">
			<div class="container">
				<a class="navbar-brand" href="/">
					<img src="/img/logo.png" alt="My Musician Site">
				</a>
				<button aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navbarNav" data-toggle="collapse" type="button">
					<span class="navbar-toggler-icon"></span>
				</button>
				<div class="collapse navbar-collapse" id="navbarNav">
					<ul class="navbar-nav ml-auto">
  <li class="nav-item">
    <a class="nav-link" href="#find-musicians">Find Musicians</a>
  </li>
  <% if (!userLoggedIn) { %>
    <li class="nav-item">
      <a class="nav-link" href="/register"><i class="fa fa-user-plus" aria-hidden="true"></i> Register</a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="/login"><i class="fa fa-sign-in" aria-hidden="true"></i> Login</a>
    </li>
  <% } else { %>
    <li class="nav-item">
      <a class="nav-link"><i class="fa fa-user" aria-hidden="true"></i> Hello, <%= username %></a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="/logout"><i class="fa fa-sign-out" aria-hidden="true"></i> Logout</a>
    </li>
  <% } %>
</ul>
				</div>
			</div>
		</nav>
		<div class="hero">
			<div class="container">
				<h1 class="hero-title">Find the Perfect Musician for Your Band or Project</h1>
				<p class="hero-subtitle">Join our community today and connect with talented musicians from around the world.</p>
				<a class="btn btn-primary btn-lg" href="/register">Register Now</a>
			</div>
		</div>
	</header>
	<main class="main">
		<section class="section section-search" id="find-musicians">
			<div class="container">
				<h2 class="section-title"><i class="fa fa-search" aria-hidden="true"></i> Find Musicians</h2>
				<form class="form-search" action="/search" method="get">
					<div class="form-group">
						<label for="role"><i class="fa fa-users" aria-hidden="true"></i> Role:</label> 
						<select class="form-control" id="role" name="role">
							<option value="">All</option>
							<option value="Band">Band</option>
							<option value="Artist">Artist</option>
						</select>
					</div>
					
					<div class="form-group">
  <label for="genre">Search by genre:</label>
  <select class="form-control" id="genre" name="genre">
    <option value="">All</option>
  </select>
</div>
<div class="form-group">
						<label for="city"><i class="fa fa-map-marker" aria-hidden="true"></i> Location:</label> 
						<input id="city" name="city" type="text" class="form-control" autocomplete="on" value="<%= city %>" data-value="">
					</div>
					<button class="btn btn-primary" type="submit"><i class="fa fa-search" aria-hidden="true"></i> Search</button>
				</form>
			</div>
		</section>
		<!-- audio player -->
		<div class="audio-player">
  <div class="audio-player-inner">
    <div class="audio-tracklist">
      <% tracks.forEach((track, index) => { %> 
        <div class="audio-track">
          <div class="audio-track-image">
            <img src="/img/<%= track.image_filename || 'default-track-image.png' %>" alt="<%= track.title %>">
          </div>
          <div class="audio-track-info">
            <h4><%= track.title %></h4> 
            <p class="album-title"><%= track.album_title || "No Album" %></p>
          </div>
          <div class="audio-player-wrapper">
            <button class="audio-player-button" onclick="togglePlay(<%= index %>)">
              <i class="audio-player-icon fa fa-play"></i>
            </button>
            <audio id="audio-<%= index %>" src="/tracks/<%= track.filename %>" ontimeupdate="updateProgress(<%= index %>)"></audio>
            <input type="range" id="progress-bar-<%= index %>" class="progress-bar" value="0" onchange="setProgress(<%= index %>, this.value)">
            <span class="progress-time" id="progress-time-<%= index %>">0:00</span>
          </div>
        </div> 
      <% }); %>
    </div>
  </div>
</div>
<!-- end -->
	</main>
	<footer class="footer">
		<div class="container">
			<p class="text-center mb-0">My Musician Site &copy; 2023</p>
		</div>
	</footer>
	<script>
	function togglePlay(index) {
  const audio = document.getElementById(`audio-${index}`);
  const button = document.querySelector(`.audio-track:nth-child(${index + 1}) .audio-player-button`);
  if (audio.paused) {
    audio.play();
    button.innerHTML = '<i class="audio-player-icon fa fa-pause"></i>';
  } else {
    audio.pause();
    button.innerHTML = '<i class="audio-player-icon fa fa-play"></i>';
  }
}

function setProgress(index, value) {
  const audio = document.getElementById(`audio-${index}`);
  audio.currentTime = (value / 100) * audio.duration;
}

function updateProgress(index) {
  const audio = document.getElementById(`audio-${index}`);
  const progressBar = document.getElementById(`progress-bar-${index}`);
  const progressTime = document.getElementById(`progress-time-${index}`);
  const value = (audio.currentTime / audio.duration) * 100;
  progressBar.value = value;
  const minutes = Math.floor(audio.currentTime / 60);
  const seconds = Math.floor(audio.currentTime % 60).toString().padStart(2, '0');
  progressTime.innerHTML = `${minutes}:${seconds}`;
}
	</script>
	
	<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
	
	<script>
  const playButtons = document.querySelectorAll('.fa-play');
  playButtons.forEach((button, index) => {
    const audio = document.querySelector(`#audio-${index}`);
    button.addEventListener('click', () => {
      audio.play();
    });
  });
</script>
    
    
	<script>
	$("#city").autocomplete({
    source: '/autocomplete/cities',
    minLength: 1,
  });

  const queryInput = document.querySelector("#query");
  const roleInput = document.querySelector("#role");
  const cityInput = document.querySelector("#city");

  queryInput.value = "<%= query %>";
  roleInput.value = "<%= role %>";
  cityInput.value = cityInput.getAttribute('data-value');

  const query = queryInput.value;
  const role = roleInput.value;
  const city = cityInput.value;
	</script>
	<script>
const genres = ["Rock", "Pop", "Jazz", "Blues", "Country"];
const genreSelect = document.querySelector("#genre");
genres.forEach((genre) => {
  const option = document.createElement("option");
  option.value = genre;
  option.text = genre;
  genreSelect.appendChild(option);
});
</script>

  </body>
</html>

css:
/* audio player */
.audio-player {
  margin: 50px auto;
  max-width: 800px;
}

.audio-player-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.audio-tracklist {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audio-track {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-right: 20px;
  margin-bottom: 20px;
  max-width: 300px;
  text-align: center;
  height: auto; 
  position: relative;
}

.audio-track-image {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  position: relative;
}

.audio-track-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.audio-track-info {
  width: 100%;
  margin-top: 10px;
  text-align: center;
}

.audio-track-info h4 {
  margin-top: 0;
  font-size: 18px;
  font-weight: bold;
}

.audio-track-info p {
  margin-bottom: 0;
  font-size: 14px;
}

.audio-player-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 50px;
  margin-top: 10px;
}

.audio-player-button {
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  background: none;
  cursor: pointer;
  margin-right: 10px;
}

.audio-player-icon {
  font-size: 24px;
  color: #333;
}

.progress-bar {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  outline: none;
  cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
}

.progress-bar::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
}

.progress-time {
  font-size: 12px;
  margin-left: 10px;
  color: #666;
}