新增播放速率调整功能

This commit is contained in:
lyswhut
2023-02-08 18:27:35 +08:00
parent 9522e975a0
commit f809782559
27 changed files with 450 additions and 154 deletions
+21
View File
@@ -69,6 +69,7 @@ const handleDesktopLyricMessage = (action: LX.DesktopLyric.WinMainActions) => {
action: 'set_status',
data: {
isPlay: isPlay.value,
rate: appSetting['player.playbackRate'],
line: lyric.line,
played_time: getCurrentTime(),
},
@@ -100,6 +101,7 @@ export const init = () => {
setLines(markRawList([...lines]))
setText(lines[0] ?? '', 0)
},
rate: appSetting['player.playbackRate'],
// offset: 80,
})
@@ -143,6 +145,25 @@ export const setLyricOffset = (offset: number) => {
}
}
export const setPlaybackRate = (rate: number) => {
lrc.setPlaybackRate(rate)
sendDesktopLyricInfo({
action: 'set_playbackRate',
data: rate,
})
if (isPlay.value) {
setTimeout(() => {
const time = getCurrentTime()
sendDesktopLyricInfo({
action: 'set_play',
data: time,
})
lrc.play(time)
})
}
}
export const setLyric = () => {
if (!musicInfo.id) return
if (musicInfo.lrc) {