From b610198a6dbbb96605c2e72ac5f8adc8755d7f77 Mon Sep 17 00:00:00 2001 From: Brenna Gonsalves Date: Sun, 21 Jun 2020 15:58:28 -0400 Subject: [PATCH 1/5] index.html --- index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 83c9da28..6f8647f1 100644 --- a/index.html +++ b/index.html @@ -25,8 +25,8 @@

-

-
+

Pablo Picaso

+
1909 Spanish Records
@@ -36,11 +36,11 @@

- + - +
@@ -71,7 +71,7 @@

- +
From 3ba128d12b9aa76c1b0e851b16886e02d0290982 Mon Sep 17 00:00:00 2001 From: Brenna Gonsalves Date: Sun, 21 Jun 2020 15:58:43 -0400 Subject: [PATCH 2/5] scripts --- scripts/album-info.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/album-info.js b/scripts/album-info.js index e69de29b..b2833a23 100644 --- a/scripts/album-info.js +++ b/scripts/album-info.js @@ -0,0 +1,4 @@ +{ +$('#album-title').text(album.title); +$('img#album-cover-art').attr('src', album.albumArtUrl); +} From 16e561c88148c8ede9587fc6bbaba7daad045eba Mon Sep 17 00:00:00 2001 From: Brenna Gonsalves Date: Sun, 21 Jun 2020 16:18:06 -0400 Subject: [PATCH 3/5] scripts --- scripts/song-list.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/song-list.js b/scripts/song-list.js index e69de29b..00c675f8 100644 --- a/scripts/song-list.js +++ b/scripts/song-list.js @@ -0,0 +1,24 @@ +{ + album.songs.forEach( (song, index) => { + song.element = $(` + + + + + ${song.title} + ${song.duration} + + `); + + song.element.on('click', event => { + player.playPause(song); + }); + + + $('#song-list').append(song.element); + }); + } From 0c297efbfad5d76057effc184ddb8122ee4909be Mon Sep 17 00:00:00 2001 From: Brenna Gonsalves Date: Thu, 25 Jun 2020 14:45:07 -0400 Subject: [PATCH 4/5] scripts --- scripts/player-bar.js | 23 +++++++++++++++++++++++ scripts/song-list.js | 1 + 2 files changed, 24 insertions(+) diff --git a/scripts/player-bar.js b/scripts/player-bar.js index e69de29b..259e904c 100644 --- a/scripts/player-bar.js +++ b/scripts/player-bar.js @@ -0,0 +1,23 @@ +{ + $('button#play-pause').on('click', function() { + player.playPause(); + $('button#play-pauuse').attr('playState', player.playState); + }); + + $('button#next').on('click', function(){ + player.playPause(); + $(this).attr('playState', player.playState); + ) + }); + + $('button#next').on('click', function(){ + if(play.playState !== 'playing') {return;} + }); + const currentSongIndex = album.songs.indexOf(player.currentlyPlaying); + const nextSongIndex = currentSongIndex + 1; + if(nextSongIndex >= album.songs.length) {return;} + + const nextSong = album.songs[nextSongIndex]; + player.playPause(nextSong); + }); +} diff --git a/scripts/song-list.js b/scripts/song-list.js index 00c675f8..bb13455f 100644 --- a/scripts/song-list.js +++ b/scripts/song-list.js @@ -16,6 +16,7 @@ song.element.on('click', event => { player.playPause(song); + $('button#play-pause').attr('playState',player.playState); }); From a01777a7b69f8188777cffdda9079a97499f063a Mon Sep 17 00:00:00 2001 From: Brenna Gonsalves Date: Tue, 30 Jun 2020 14:10:48 -0400 Subject: [PATCH 5/5] scripts --- scripts/player-bar.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/player-bar.js b/scripts/player-bar.js index 259e904c..e2e1a832 100644 --- a/scripts/player-bar.js +++ b/scripts/player-bar.js @@ -16,8 +16,21 @@ const currentSongIndex = album.songs.indexOf(player.currentlyPlaying); const nextSongIndex = currentSongIndex + 1; if(nextSongIndex >= album.songs.length) {return;} - + const nextSong = album.songs[nextSongIndex]; player.playPause(nextSong); }); + + $('#time-control input').on('input', function (event) { + player.skipTo(event.target.value); + }); + + setInterval( () => { + if (player.playState !== 'playing') { return; } + const currentTime = player.getTime(); + const duration = player.getDuration(); + const percent = (currentTime / duration) * 100; + $('#time-control .current-time').text( currentTime ); + $('#time-control input').val(percent); + }, 1000); }