Case Study: Jamboree Jukebox

A music player webpage, built with Javascript, CSS, and HTML.

Hannah Ebba
4 min readDec 3, 2023

PROJECT DATE: October 2023

OVERVIEW

For my Advanced Web Development course, we were given a sample of code that displayed a button that would play music when clicked, along with a progress bar and the ability to download the song. We then were tasked to build a “jukebox”- a fully-functional page that, through our own creative direction, allows the user to play music. I decided to utilize my own playlists and allow people to select songs from a collection.

Tools used: Javascript, HTML, CSS, Procreate, Music API (made by professor for class)

THE CHALLENGE

Because I had no prior experience with Javascript before this class, all attempts I made to expand beyond the bare bones of class assignments were purely from trial and error. I quickly found that making a dropdown list for the songs was going to be my biggest hurdle because the starter code tied all potential songs to a single player button in the HTML sheet.

Starter code fro a music playing button using Javascript and HTML.
The starter code for a music button. The function player is tied to the “play song” button, which is displayed in a div titled “juke”.

The “tune” variable sets the value of the function to songs that are labelled “tune”. But how do these songs get this label?

A screenshot of a music player button, labelled “play song”. (From left to right): time stamp and alotted time, an empty progress bar, a volume icon, and three dots at the end.
The song designated for this button is labelled “tune”. However, since there are no songs in my webpage yet, the play button is disabled.

Because the starter code provides one function, all of the songs I would want to play from it would have to be in a single category. I wanted to do something completely different from this!

THE SOLUTION

My professor, Emuel Aldrige, helped me out because he was happy that I was thinking of utilizing dropdown lists, which he said he hadn’t witnessed before for this project. Through his guidance, I determined that each playlist would have its own function that performed the same actions.

Each of the three playlists were then tied to its own list container in HTML, which I designed to generate three evenly-spaced columns. The separation was made possible by assigning each player function to a unique id, which aligned with their <select> elements in the HTML sheet.

A screenshot of HTML code that displays 3 playlists with the playlist name and a dropdown list.
HTML code for the playlists and their respective dropdown lists
A screenshot of Javascript code that generates a player button for 3 playlists, each with 5 unique songs.
Functions for each playlist that generate a player button inside a #juke div

The functions each generated a player button using <audio>, in the #juke div. Although it appears that a single button is being activated each time a song is selected, the code actually generates a new button in the exact same space. Let’s look closer at this specific code snippet:

document.querySelector(‘#juke’).innerHTML = “<audio controls autoplay src=” + thesong + “ type = ‘audio/m4a’></audio>”

The “thesong” variable being reused is what enables the songs from other playlists to be replaced from the #juke div each time a new song is selected. In addition, the fact that I used “=” instead of “+=” ensures that only one song is played at a time when selected. If I incremented it, all of the songs from the selected playlist would play after each other.

RESULTS

I built three separate arrays for each playlist. Each array had multiple series of objects, each with song name, artist, and music file strings. Each playlist array was assigned to its own dropdown list, which generated all of its songs at once using this code snippet:

<option value=” + playlists.playlist1[i].audiofile + “>”

A screenshot of Javascript code. It displays song names, song files, and artist names in an array.
Playlist arrays

I then incremented the values of the songs using i++, to ensure that the list would display all of the values rather than a single song.

A screenshot of Javascript code. It generates a dropdown list for music files from a specific playlist.
Dropdown lists

I used the same names of 3 of my real playlists, and added a handful of songs from each of them! If I were to ever expand on this project in the future, I would want to try having the player button have a pause, skip, and back option, as well as displaying other attributes above it, such as repeating the song title and artist, as well as the album it belongs to.

A screenshot of a player button over a purple and pink background. (from left to right): play button, the time stamp and duration, a progress bar, a volume button, and three dots.
Current player button on my webpage

When listening to a song on Spotify, especially album singles, often times the screen will display a short animation clip or GIF that represents the artist’s work.

A GIF of an animation for a song playing on Spotify. It is for the song “Losing You” by British artist group Flo, and it features the girls (Jorja, Stella, and Renee) stacking their hands onto each other. It then cuts to a silhouette of them leaning on each other in front of a curtain with sunlight behind it.
A Spotify music animation for “Losing You” by Flo

I used that tactic to create my own GIF :) I used Animation Assist on Procreate to create a StopMotion animation of me on the train!

A screenshot of my webpage. A drawing with a purple translucent hue is the background image. It has a Black girl with glasses and brown curly hair sitting on a train, listening to music with silver headphones. Other passengers on the train include a brown woman with short brown hair looking out the window, and a Black girl with an orange sweater and white shirt talking on the phone. On top of the drawing, there are three playlist options, each with a dropdown menu of songs to choose from.
My webpage!

Another similar example of this style is the infamous Lo-Fi Beats playlist, which is known by everyone my age because of its popularity and extremely long duration.

An anime-style drawing of a girl with brown hair studying at night at a bedroom desk beside a window. There is an orange cat on the windowsill. The girl is wearing a green sweater, a red scarf, and headphones, and she is writing in a notebook.
A screenshot of “Lo-Fi Girl”. Open the YouTube video to see the GIF!

--

--