Skip to content

Commit 9864458

Browse files
committed
optimize error handling; remove line before current time
1 parent 454019f commit 9864458

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/js/lrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Lrc {
4444
this.parsed[index] = this.parse(xhr.responseText);
4545
}
4646
else {
47-
console.log('Request was unsuccessful: ' + xhr.status);
47+
this.player.notice(`LRC file request fails: status ${xhr.status}`);
4848
this.parsed[index] = [['00:00', 'Not available']];
4949
}
5050

src/js/player.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class APlayer {
105105
this.audio.preload = this.options.preload;
106106

107107
for (let i = 0; i < this.events.audioEvents.length; i++) {
108-
this.audio.addEventListener(this.events.audioEvents[i], () => {
109-
this.events.trigger(this.events.audioEvents[i]);
108+
this.audio.addEventListener(this.events.audioEvents[i], (e) => {
109+
this.events.trigger(this.events.audioEvents[i], e);
110110
});
111111
}
112112

@@ -148,7 +148,7 @@ class APlayer {
148148

149149
// audio download error: an error occurs
150150
this.on('error', () => {
151-
this.notice('An audio error has occurred.', 0);
151+
this.notice('An audio error has occurred.');
152152
});
153153

154154
// multiple audio play

src/template/player.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</div>
2424
<div class="aplayer-time">
2525
<span class="aplayer-time-inner">
26-
- <span class="aplayer-ptime">00:00</span> / <span class="aplayer-dtime">00:00</span>
26+
<span class="aplayer-ptime">00:00</span> / <span class="aplayer-dtime">00:00</span>
2727
</span>
2828
<div class="aplayer-volume-wrap">
2929
<button type="button" class="aplayer-icon aplayer-icon-volume-down">

0 commit comments

Comments
 (0)