File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ var AudioPlayer = (function() {
84
84
repeating = false ,
85
85
// either null or an array of all indices which were not played yet
86
86
shuffling = null ,
87
+ played = [ ] ,
87
88
seeking = false ,
88
89
rightClick = false ,
89
90
apActive = false ,
@@ -313,6 +314,8 @@ var AudioPlayer = (function() {
313
314
return ;
314
315
}
315
316
317
+ played . push ( index )
318
+
316
319
audio . src = playList [ index ] . file ;
317
320
audio . preload = 'auto' ;
318
321
document . title = trackTitle . innerHTML = playList [ index ] . title ;
@@ -327,7 +330,12 @@ var AudioPlayer = (function() {
327
330
}
328
331
329
332
function prev ( ) {
330
- index = index - 1 ;
333
+ if ( played . length > 1 ) {
334
+ index = played . splice ( - 2 ) [ 0 ] ;
335
+ } else {
336
+ index = 0 ;
337
+ }
338
+
331
339
play ( ) ;
332
340
}
333
341
You can’t perform that action at this time.
0 commit comments