Skip to content

Commit 1235cff

Browse files
authored
fix(audio): try to fix error when lrc is empty (#129)
1 parent 84359f5 commit 1235cff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pages/home/previews/audio.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ const Preview = () => {
7373
lrcType: objStore.provider === "NeteaseMusic" ? 1 : 3,
7474
audio: audios.map(objToAudio),
7575
})
76+
77+
// Apply monkey patch to fix https://github.com/DIYgod/APlayer/issues/283
78+
const _switch = ap.lrc.switch
79+
const _update = ap.lrc.update
80+
ap.lrc.switch = (index: any) => {
81+
ap.lrc.update = () => {}
82+
_switch.call(ap.lrc, index)
83+
ap.lrc.update = _update
84+
}
85+
7686
if (objStore.provider === "NeteaseMusic") {
7787
ap.on("loadstart", () => {
7888
const i = ap.list.index

0 commit comments

Comments
 (0)