This project is a simple browser‑based audio player that loops through multiple MP3 files in sequence. When the last track finishes, the playlist automatically restarts from the beginning. Everything runs locally in your browser — no uploads, no server, no dependencies.
-
Prepare your audio files
- Place your
.mp3files (e.g.,song1.mp3,song2.mp3,song3.mp3) in the same directory as your HTML file. - Update the
filesarray in the script to match your filenames.
- Place your
-
Open the file in a browser
- Double-click the HTML file to open it in your default web browser.
- The player will start automatically and cycle through your songs.
-
Audio files not playing?
- Ensure the filenames in the
filesarray exactly match your.mp3files (including capitalization). - Check that the audio files are in the same folder as your HTML file.
- Ensure the filenames in the
-
Player controls not showing?
- Make sure your browser supports HTML5 audio.
- Try opening the file in a different browser (Chrome, Firefox, Edge, etc.).
-
Want to add more songs?
- Simply add more filenames to the
filesarray, e.g.:const files = [ "song1.mp3", "song2.mp3", "song3.mp3", "song4.mp3" ];
- Simply add more filenames to the
-
Player not looping?
- Verify that the
endedevent listener is correctly attached and that theplayNextfunction is called.
- Verify that the
-
Change the order of songs Rearrange the filenames in the
filesarray. -
Start with a specific song Set the
indexvariable to the desired starting position (0 is the first song). -
Add more controls You can add buttons for play/pause, next, and previous using additional JavaScript and HTML.