File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -83,4 +83,35 @@ function random_bg_color() {
8383 document . body . style . background = bgColor ;
8484}
8585
86+ function playpauseTrack ( ) {
87+ if ( ! isPlaying ) playTrack ( ) ;
88+ else pauseTrack ( ) ;
89+ }
90+ function playTrack ( ) {
91+ curr_track . play ( ) ;
92+ isPlaying = true ;
93+
94+ playPauseBtn . innerHTML = '<i class = "fa fa-pause-circle fa-5x"</i>' ;
95+ }
96+ function pauseTrack ( ) {
97+ curr_track . pause ( ) ;
98+ isPlaying = false ;
99+
100+ playPauseBtn . innerHTML = '<i class = "fa fa-play-circle fa-5x"</i>' ;
101+ }
102+ function nextBtn ( ) {
103+ if ( trackIndex < track_list . length - 1 )
104+ trackIndex += 1 ;
105+ else trackIndex = 0 ;
106+
107+ loadTrack ( trackIndex ) ;
108+ playTrack ( ) ;
109+ }
110+ function prevBtn ( ) {
111+ if ( trackIndex > 0 )
112+ trackIndex -= 1 ;
113+ else trackIndex = track_list . length - 1 ;
86114
115+ loadTrack ( trackIndex ) ;
116+ playTrack ( ) ;
117+ }
You can’t perform that action at this time.
0 commit comments