diff --git a/src/components/Player.vue b/src/components/Player.vue
index 62845e8..e87b5a2 100644
--- a/src/components/Player.vue
+++ b/src/components/Player.vue
@@ -156,7 +156,7 @@ export default {
mounted() {
setInterval(() => {
this.progress = ~~this.player.seek();
- }, 1000);
+ }, 500);
if (isAccountLoggedIn()) {
userLikedSongsIDs(this.data.user.userId).then((data) => {
this.updateLikedSongs(data.ids);
diff --git a/src/utils/lyrics.js b/src/utils/lyrics.js
index 230fa20..c68bb42 100644
--- a/src/utils/lyrics.js
+++ b/src/utils/lyrics.js
@@ -2,8 +2,8 @@
export function lyricParser(lrc) {
return {
- lyric: parseLyric(lrc.lrc.lyric || ""),
- tlyric: parseLyric(lrc.tlyric.lyric || ""),
+ lyric: parseLyric(lrc?.lrc?.lyric || ""),
+ tlyric: parseLyric(lrc?.tlyric?.lyric || ""),
lyricuser: lrc.lyricUser,
transuser: lrc.transUser,
};
diff --git a/src/views/lyrics.vue b/src/views/lyrics.vue
index 3f88d59..42732e4 100644
--- a/src/views/lyrics.vue
+++ b/src/views/lyrics.vue
@@ -119,6 +119,7 @@
@@ -162,7 +163,7 @@ export default {
lyricsInterval: null,
lyric: [],
tlyric: [],
- highlightLyricIndex: -1,
+ highlightLyricIndex: 0,
minimize: true,
};
},
@@ -244,7 +245,7 @@ export default {
...mapMutations(["toggleLyrics"]),
getLyric() {
return getLyric(this.currentTrack.id).then((data) => {
- if (data.nolyric) {
+ if (!data?.lrc?.lyric) {
this.lyric = [];
this.tlyric = [];
return false;
@@ -275,10 +276,12 @@ export default {
);
});
if (oldHighlightLyricIndex !== this.highlightLyricIndex) {
- const el = document.getElementById(
- `line-${this.highlightLyricIndex}`
- );
- if (el) el.scrollIntoView({ behavior: "smooth", block: "center" });
+ const el = document.getElementById(`line${this.highlightLyricIndex}`);
+ if (el)
+ el.scrollIntoView({
+ behavior: "smooth",
+ block: "center",
+ });
}
}, 500);
},
@@ -294,12 +297,7 @@ export default {
},
watch: {
currentTrack() {
- this.getLyric().then((result) => {
- if (result) {
- const el = document.getElementById(`line-0`);
- el.scrollIntoView({ block: "center" });
- }
- });
+ this.getLyric();
},
showLyrics(show) {
if (show) {