Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brennan's Music Player #64

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5928d2c
built basic file structure
BrennanFulmer Mar 14, 2018
ffbaa0d
added mockup
BrennanFulmer Mar 21, 2018
672c54e
added mockups to folder
BrennanFulmer Mar 21, 2018
fb6e63a
working out basic html
BrennanFulmer Mar 21, 2018
bfa80d8
added normalize css reset
BrennanFulmer Mar 21, 2018
f7747f7
base layout done
BrennanFulmer Mar 22, 2018
a6c4126
adding symbols and restructuring layout to accomodate
BrennanFulmer Mar 26, 2018
dd6b24a
added play button to song list
BrennanFulmer Mar 27, 2018
ff18105
switched icons and did some minor repositioning
BrennanFulmer Mar 27, 2018
da3e3f5
almost done with the look
BrennanFulmer Mar 27, 2018
e48cf00
replaced play bar play button
BrennanFulmer Mar 28, 2018
c9035c0
continued working on button aesthetics
BrennanFulmer Mar 28, 2018
94e39a5
finished base layout, just need to find and workout the css for a sto…
BrennanFulmer Mar 29, 2018
336a6ac
minor tweaks and found stop button pic
BrennanFulmer Mar 29, 2018
44beaf1
adding responsiveness to accommodate mobile devices
BrennanFulmer Mar 29, 2018
555a5c9
finished layout, now simplifying for javascript functionality
BrennanFulmer Mar 29, 2018
820fb0d
moved images into seperate folder
BrennanFulmer Mar 30, 2018
8d4f038
modified naming in preparation for js changes/implementation
BrennanFulmer Mar 30, 2018
2adf03b
re-including files, and tweaked TODO section
BrennanFulmer Mar 30, 2018
2eb2faf
seperated style sheets off into their own folder, and moved all asset…
BrennanFulmer Apr 4, 2018
7ee4ec2
corrected sass cache folders path
BrennanFulmer Apr 4, 2018
b356089
re-adding sass cache as a new one has to be created apparently
BrennanFulmer Apr 4, 2018
d25bd80
its now possible to toggle a single class to start and stop a song (v…
BrennanFulmer Apr 4, 2018
714c998
setup for js portion
BrennanFulmer Apr 4, 2018
4617bb1
reworked classes that handle a song playing for easier use with js
BrennanFulmer Apr 4, 2018
9a018fd
renamed status bar class/picture as its used to pause a song - not st…
BrennanFulmer Apr 4, 2018
2d8dcb9
basic song play button functionality
BrennanFulmer Apr 10, 2018
1b30086
basic button image swap event now affects both song clicked on and st…
BrennanFulmer Apr 10, 2018
ad2ece3
finished song play button click event
BrennanFulmer Apr 10, 2018
06bd859
saving mid way through working out status play button
BrennanFulmer Apr 11, 2018
b0d3721
finished status bar play button event
BrennanFulmer Apr 12, 2018
0ee4ce4
finished song stop button event
BrennanFulmer Apr 12, 2018
3f89dcf
removed mentions of stop button and switch to just pause buttons
BrennanFulmer Apr 12, 2018
8ddf3c4
swapped out status pause button as it was actually the stop symbol
BrennanFulmer Apr 12, 2018
9d0d62e
status pause button complete
BrennanFulmer Apr 12, 2018
b52f400
minor tweaks to reduce repetitive code, and to make variable names mo…
BrennanFulmer Apr 12, 2018
23574bd
working through previous button
BrennanFulmer Apr 13, 2018
548733b
finished previous button event
BrennanFulmer Apr 13, 2018
65849f4
finished the final button, the next button in the status bar
BrennanFulmer Apr 13, 2018
ff805f9
cleaned up variables to reduce repeats
BrennanFulmer Apr 16, 2018
02354bd
replaced adding classes for button change with a function
BrennanFulmer Apr 17, 2018
b2c1163
replaced status bar text change with the songChange function
BrennanFulmer Apr 17, 2018
34f1e46
more variable simplification and replaced find song while loops with …
BrennanFulmer Apr 17, 2018
dd6f93c
finished refactor - now for actual audio
BrennanFulmer Apr 18, 2018
5c438b4
before testing audio
BrennanFulmer Apr 18, 2018
7adb143
added basic audio capability
BrennanFulmer Apr 19, 2018
d33ffa2
finished creating an event to handle when a song ends
BrennanFulmer Apr 20, 2018
1c5996d
merged several functions to make it so there's a single function to h…
BrennanFulmer Apr 21, 2018
405ae61
finishing touches
BrennanFulmer Apr 21, 2018
e8e74c3
added link to readme
BrennanFulmer Apr 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# assignment_royalty_free_music_player
Ushering in the reign of Royalty Free Music w/ JavaScript.

by Brennan Fulmer

https://brennanfulmer.github.io/assignment_royalty_free_music_player/

All songs used are owned by their respective artists, and are only being used
by me under their creative commons licenses. I have made no changes to the
songs and have received no endorsement from their creators. For more from these
musicians see the links to their albums below. I've also included links to
their albums licenses for compliance reasons.

Siesta and Fireworks by Jahzzar
https://freemusicarchive.org/music/Jahzzar/Travellers_Guide/
https://creativecommons.org/licenses/by-sa/3.0/

Favorite Secrets and Bronco Romp by Waylon Thornton
https://freemusicarchive.org/music/Waylon_Thornton/Mystery_Club/
https://creativecommons.org/licenses/by-nc-sa/3.0/us/

Springish by Gillicuddy
https://freemusicarchive.org/music/gillicuddy/Plays_Guitar/
https://creativecommons.org/licenses/by-nc/3.0/
Binary file added assets/audio/Bronco_Romp_by_Waylon_Thornton.mp3
Binary file not shown.
Binary file not shown.
Binary file added assets/audio/Fireworks_by_Jahzzar.mp3
Binary file not shown.
Binary file added assets/audio/Siesta_by_Jahzzar.mp3
Binary file not shown.
Binary file added assets/audio/Springish_by_Gillicuddy.mp3
Binary file not shown.
Binary file added assets/images/crown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/song_pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/song_play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/status_pause.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/status_play.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/status_switch.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/mockups/No_Song_Playing_Mockup.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/mockups/Song_Playing_Mockup.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions assets/scripts/music_player.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

var statusBar = document.getElementsByClassName("status")[0].children,
statusPlay = statusBar[1],
statusPause = statusBar[2],
statusSong = statusBar[4],
statusArtist = statusBar[5],
audios = document.querySelectorAll("audio"),
songs = document.getElementsByClassName("song"),
songPlay = document.getElementsByClassName("song-play"),
songPause = document.getElementsByClassName("song-pause");

function pauser(song) {
song[4].pause();
song[0].classList.remove("hide");
song[1].classList.remove("playing");
statusPlay.classList.remove("hide");
statusPause.classList.remove("playing");
}

function starter(song) {
song[4].play();
song[0].classList.add("hide");
song[1].classList.add("playing");
statusPlay.classList.add("hide");
statusPause.classList.add("playing");
statusSong.innerHTML = song[2].innerHTML;
statusArtist.innerHTML = song[3].innerHTML;

for (var step = 0; step < 5; step++) {
if (audios[step].paused && audios[step].currentTime > 0) {
audios[step].currentTime = 0;
}
}
}

function seek() {
for (var piece in songs) {
if (
songs[piece].children[2].innerHTML == statusSong.innerHTML &&
songs[piece].children[3].innerHTML == statusArtist.innerHTML
) {
return songs[piece];
}
}
}

function lookup(listing) {
for (var sequence = 0; sequence < 5; sequence++) {
if (songs[sequence].getAttribute("num") == listing) {
return songs[sequence].children;
}
}
}

function next(current) {
pauser(current.children);

if (current.getAttribute("num") == 5) {
var numeral = 1;
} else {
var numeral = parseFloat(current.getAttribute("num")) + 1;
}

starter(lookup(numeral));
}

// song play button
for (var counter = 0; counter < 5; counter++) {
songPlay[counter].addEventListener("click", function(action) {
var played = document.getElementsByClassName("song-pause playing")[0];

if (played != undefined) {
pauser(played.parentNode.children);
}

starter(action.target.parentNode.children);
});
}
// song play button

// status play button
statusPlay.addEventListener("click", function() {
starter(seek().children);
});
// status play button

// song pause button
for (var limit = 0; limit < 5; limit++) {
songPause[limit].addEventListener("click", function(root) {
pauser(root.target.parentNode.children);
});
}
// song pause button

// status pause button
statusPause.addEventListener("click", function() {
pauser(seek().children);
});
// status pause button

// status previous button
statusBar[0].addEventListener("click", function() {
var subjectSong = seek();

pauser(subjectSong.children);

if (subjectSong.getAttribute("num") == 1) {
var symbol = 5;
} else {
var symbol = subjectSong.getAttribute("num") - 1;
}

starter(lookup(symbol));
});
// status previous button

// status after button
statusBar[3].addEventListener("click", function() {
next(seek());
});
// status after button

// song finish handler
for (var tick = 0; tick < 5; tick++) {
audios[tick].addEventListener("ended", function(ended) {
next(ended.target.parentNode);
});
}
// song finish handler
Binary file not shown.
Loading