File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ class List {
107107 list [ index ] . remove ( ) ;
108108
109109 this . audios . splice ( index , 1 ) ;
110- this . lrc . parsed . splice ( index , 1 ) ;
110+ this . player . lrc && this . player . lrc . remove ( index ) ;
111111
112112 if ( index === this . index ) {
113113 if ( this . audios [ index ] ) {
@@ -178,7 +178,7 @@ class List {
178178 this . player . container . classList . remove ( 'aplayer-withlist' ) ;
179179 this . player . pause ( ) ;
180180 this . audios = [ ] ;
181- this . lrc . parsed = [ ] ;
181+ this . player . lrc && this . player . lrc . clear ( ) ;
182182 this . player . audio . src = '' ;
183183 this . player . template . listOl . innerHTML = '' ;
184184 this . player . template . pic . style . backgroundImage = '' ;
Original file line number Diff line number Diff line change @@ -131,6 +131,15 @@ class Lrc {
131131 return [ ] ;
132132 }
133133 }
134+
135+ remove ( index ) {
136+ this . parsed . splice ( index , 1 ) ;
137+ }
138+
139+ clear ( ) {
140+ this . parsed = [ ] ;
141+ this . container . innerHTML = '' ;
142+ }
134143}
135144
136145export default Lrc ;
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ class APlayer {
159159 // audio download error: an error occurs
160160 let skipTime ;
161161 this . on ( 'error' , ( ) => {
162- if ( this . list . audios . length ) {
162+ if ( this . list . audios . length > 1 ) {
163163 this . notice ( 'An audio error has occurred, player will skip forward in 2 seconds.' ) ;
164164 skipTime = setTimeout ( ( ) => {
165165 this . skipForward ( ) ;
@@ -168,7 +168,7 @@ class APlayer {
168168 }
169169 } , 2000 ) ;
170170 }
171- else {
171+ else if ( this . list . audios . length === 1 ) {
172172 this . notice ( 'An audio error has occurred.' ) ;
173173 }
174174 } ) ;
You can’t perform that action at this time.
0 commit comments