修复重启后歌词快进不生效的问题
parent
3d469a4986
commit
e81d594d01
|
@ -34,6 +34,7 @@ declare namespace LX {
|
||||||
'player.isShowLyricTranslation': LX.AppSetting['player.isShowLyricTranslation']
|
'player.isShowLyricTranslation': LX.AppSetting['player.isShowLyricTranslation']
|
||||||
'player.isShowLyricRoma': LX.AppSetting['player.isShowLyricRoma']
|
'player.isShowLyricRoma': LX.AppSetting['player.isShowLyricRoma']
|
||||||
'player.isPlayLxlrc': LX.AppSetting['player.isPlayLxlrc']
|
'player.isPlayLxlrc': LX.AppSetting['player.isPlayLxlrc']
|
||||||
|
'player.playbackRate': LX.AppSetting['player.playbackRate']
|
||||||
}
|
}
|
||||||
|
|
||||||
type WinMainActions = 'get_info' | 'get_status' | 'get_analyser_data_array'
|
type WinMainActions = 'get_info' | 'get_status' | 'get_analyser_data_array'
|
||||||
|
@ -63,7 +64,6 @@ declare namespace LX {
|
||||||
| LyricAction<'set_status', {
|
| LyricAction<'set_status', {
|
||||||
isPlay: boolean
|
isPlay: boolean
|
||||||
line: number
|
line: number
|
||||||
rate: number
|
|
||||||
played_time: number
|
played_time: number
|
||||||
}>
|
}>
|
||||||
| LyricAction<'set_lyric', {
|
| LyricAction<'set_lyric', {
|
||||||
|
|
|
@ -84,6 +84,7 @@ export const watchConfigKeys = [
|
||||||
'player.isShowLyricTranslation',
|
'player.isShowLyricTranslation',
|
||||||
'player.isShowLyricRoma',
|
'player.isShowLyricRoma',
|
||||||
'player.isPlayLxlrc',
|
'player.isPlayLxlrc',
|
||||||
|
'player.playbackRate',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export const buildLyricConfig = (appSetting: Partial<LX.AppSetting>): Partial<LX.DesktopLyric.Config> => {
|
export const buildLyricConfig = (appSetting: Partial<LX.AppSetting>): Partial<LX.DesktopLyric.Config> => {
|
||||||
|
|
|
@ -9,6 +9,7 @@ export const init = () => {
|
||||||
lrc = new Lyric({
|
lrc = new Lyric({
|
||||||
shadowContent: true,
|
shadowContent: true,
|
||||||
activeLineClassName: 'active',
|
activeLineClassName: 'active',
|
||||||
|
rate: setting['player.playbackRate'],
|
||||||
isVertical: setting['desktopLyric.direction'] == 'vertical',
|
isVertical: setting['desktopLyric.direction'] == 'vertical',
|
||||||
onPlay(line, text) {
|
onPlay(line, text) {
|
||||||
setText(text, line)
|
setText(text, line)
|
||||||
|
|
|
@ -41,7 +41,6 @@ const handleDesktopLyricMessage = (event: LX.DesktopLyric.LyricActions) => {
|
||||||
break
|
break
|
||||||
case 'set_status':
|
case 'set_status':
|
||||||
setIsPlay(event.data.isPlay)
|
setIsPlay(event.data.isPlay)
|
||||||
setPlaybackRate(event.data.rate)
|
|
||||||
if (event.data.isPlay) play(event.data.played_time)
|
if (event.data.isPlay) play(event.data.played_time)
|
||||||
else pause()
|
else pause()
|
||||||
break
|
break
|
||||||
|
|
|
@ -34,6 +34,7 @@ export const setting = shallowReactive<LX.DesktopLyric.Config>({
|
||||||
'player.isShowLyricTranslation': false,
|
'player.isShowLyricTranslation': false,
|
||||||
'player.isShowLyricRoma': false,
|
'player.isShowLyricRoma': false,
|
||||||
'player.isPlayLxlrc': false,
|
'player.isPlayLxlrc': false,
|
||||||
|
'player.playbackRate': 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
// export const themeList = markRaw([
|
// export const themeList = markRaw([
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
import { watch } from '@common/utils/vueTools'
|
import { watch } from '@common/utils/vueTools'
|
||||||
import { setLyric, setVertical } from '@lyric/core/lyric'
|
import { setLyric, setVertical, setPlaybackRate } from '@lyric/core/lyric'
|
||||||
import { setting } from '@lyric/store/state'
|
import { getStatus } from '@lyric/core/mainWindowChannel'
|
||||||
|
import { isPlay, setting } from '@lyric/store/state'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
watch(() => setting['player.isShowLyricTranslation'], setLyric)
|
watch(() => setting['player.isShowLyricTranslation'], setLyric)
|
||||||
watch(() => setting['player.isShowLyricRoma'], setLyric)
|
watch(() => setting['player.isShowLyricRoma'], setLyric)
|
||||||
watch(() => setting['player.isPlayLxlrc'], setLyric)
|
watch(() => setting['player.isPlayLxlrc'], setLyric)
|
||||||
|
watch(() => setting['player.playbackRate'], (rate) => {
|
||||||
|
setPlaybackRate(rate)
|
||||||
|
if (isPlay.value) {
|
||||||
|
setTimeout(() => {
|
||||||
|
getStatus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
watch(() => setting['desktopLyric.direction'], (direction) => {
|
watch(() => setting['desktopLyric.direction'], (direction) => {
|
||||||
setVertical(direction == 'vertical')
|
setVertical(direction == 'vertical')
|
||||||
// if (isPlay.value)
|
// if (isPlay.value)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<material-popup-btn :class="$style.btnContent">
|
<material-popup-btn :class="$style.btnContent">
|
||||||
<button :class="[$style.btn, { [$style.active]: playbackRate != 1 }]" :aria-label="`${$t('player__playback_rate')}x${playbackRate}`">
|
<button :class="[$style.btn, { [$style.active]: playbackRate != 1 }]" :aria-label="`${$t('player__playback_rate')}${playbackRate}x`">
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="100%" viewBox="0 0 24 24" space="preserve">
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="100%" viewBox="0 0 24 24" space="preserve">
|
||||||
<use xlink:href="#icon-plex" />
|
<use xlink:href="#icon-plex" />
|
||||||
</svg>
|
</svg>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
<template #content>
|
<template #content>
|
||||||
<div :class="$style.setting">
|
<div :class="$style.setting">
|
||||||
<div :class="$style.info">
|
<div :class="$style.info">
|
||||||
<span>x{{ playbackRate }}</span>
|
<span>{{ playbackRate }}x</span>
|
||||||
<base-btn min @click="handleUpdatePlaybackRate(1)">{{ $t('player__playback_rate_reset_btn') }}</base-btn>
|
<base-btn min @click="handleUpdatePlaybackRate(1)">{{ $t('player__playback_rate_reset_btn') }}</base-btn>
|
||||||
</div>
|
</div>
|
||||||
<base-slider-bar :value="playbackRate" :min="0.5" :max="2" @change="handleUpdatePlaybackRate" />
|
<base-slider-bar :value="playbackRate" :min="0.5" :max="2" @change="handleUpdatePlaybackRate" />
|
||||||
|
|
|
@ -69,7 +69,6 @@ const handleDesktopLyricMessage = (action: LX.DesktopLyric.WinMainActions) => {
|
||||||
action: 'set_status',
|
action: 'set_status',
|
||||||
data: {
|
data: {
|
||||||
isPlay: isPlay.value,
|
isPlay: isPlay.value,
|
||||||
rate: appSetting['player.playbackRate'],
|
|
||||||
line: lyric.line,
|
line: lyric.line,
|
||||||
played_time: getCurrentTime(),
|
played_time: getCurrentTime(),
|
||||||
},
|
},
|
||||||
|
@ -147,18 +146,10 @@ export const setLyricOffset = (offset: number) => {
|
||||||
|
|
||||||
export const setPlaybackRate = (rate: number) => {
|
export const setPlaybackRate = (rate: number) => {
|
||||||
lrc.setPlaybackRate(rate)
|
lrc.setPlaybackRate(rate)
|
||||||
sendDesktopLyricInfo({
|
|
||||||
action: 'set_playbackRate',
|
|
||||||
data: rate,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (isPlay.value) {
|
if (isPlay.value) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const time = getCurrentTime()
|
const time = getCurrentTime()
|
||||||
sendDesktopLyricInfo({
|
|
||||||
action: 'set_play',
|
|
||||||
data: time,
|
|
||||||
})
|
|
||||||
lrc.play(time)
|
lrc.play(time)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,19 @@ import { setPlaybackRate as setPlayerPlaybackRate } from '@renderer/plugins/play
|
||||||
|
|
||||||
import { debounce } from '@common/utils'
|
import { debounce } from '@common/utils'
|
||||||
// import { HOTKEY_PLAYER } from '@common/hotKey'
|
// import { HOTKEY_PLAYER } from '@common/hotKey'
|
||||||
import { playbackRate, setplaybackRate } from '@renderer/store/player/playbackRate'
|
import { playbackRate, setPlaybackRate } from '@renderer/store/player/playbackRate'
|
||||||
import { appSetting, savePlaybackRate } from '@renderer/store/setting'
|
import { appSetting, savePlaybackRate } from '@renderer/store/setting'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const handleSavePlaybackRate = debounce(savePlaybackRate, 300)
|
const handleSavePlaybackRate = debounce(savePlaybackRate, 300)
|
||||||
|
|
||||||
setplaybackRate(appSetting['player.playbackRate'])
|
setPlaybackRate(appSetting['player.playbackRate'])
|
||||||
setPlayerPlaybackRate(appSetting['player.playbackRate'])
|
setPlayerPlaybackRate(appSetting['player.playbackRate'])
|
||||||
|
|
||||||
|
|
||||||
const handleSetPlaybackRate = (num: number) => {
|
const handleSetPlaybackRate = (num: number) => {
|
||||||
const rate = num < 0.5 ? 0.5 : num > 2 ? 2 : num
|
const rate = num < 0.5 ? 0.5 : num > 2 ? 2 : num
|
||||||
setplaybackRate(rate)
|
setPlaybackRate(rate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// const handleSetPlaybackRateUp = (step = 0.02) => {
|
// const handleSetPlaybackRateUp = (step = 0.02) => {
|
||||||
|
@ -37,7 +37,7 @@ export default () => {
|
||||||
setPlayerPlaybackRate(rate)
|
setPlayerPlaybackRate(rate)
|
||||||
})
|
})
|
||||||
watch(() => appSetting['player.playbackRate'], rate => {
|
watch(() => appSetting['player.playbackRate'], rate => {
|
||||||
setplaybackRate(rate)
|
setPlaybackRate(rate)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@ import { ref } from '@common/utils/vueTools'
|
||||||
|
|
||||||
export const playbackRate = ref(1)
|
export const playbackRate = ref(1)
|
||||||
|
|
||||||
export const setplaybackRate = (num: number) => {
|
export const setPlaybackRate = (num: number) => {
|
||||||
playbackRate.value = num
|
playbackRate.value = num
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue