添加播放速率

pull/1834/head
lyswhut 2024-03-29 16:48:25 +08:00
parent 5345b001e8
commit 530ace6b81
5 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,7 @@ declare namespace LX {
picUrl: string
progress: number
duration: number
playbackRate: number
lyricLineText: string
lyric: string
collect: boolean

View File

@ -242,6 +242,7 @@ export const initAppSetting = async() => {
picUrl: '',
progress: 0,
duration: 0,
playbackRate: 1,
lyricLineText: '',
lyric: '',
collect: false,

View File

@ -28,6 +28,7 @@ const handleStartServer = async(port = 9000, ip = '127.0.0.1') => new Promise<vo
duration: global.lx.player_status.duration,
progress: global.lx.player_status.progress,
picUrl: global.lx.player_status.picUrl,
playbackRate: global.lx.player_status.playbackRate,
lyricLineText: global.lx.player_status.lyricLineText,
})
break

View File

@ -187,7 +187,6 @@ export const setWindowBounds = (options: Partial<Electron.Rectangle>) => {
}
export const setProgressBar = (progress: number, options?: Electron.ProgressBarOptions) => {
if (!browserWindow) return
console.log(progress, options)
browserWindow.setProgressBar(progress, options)
}
export const setIgnoreMouseEvents = (ignore: boolean, options?: Electron.IgnoreMouseEventsOptions) => {

View File

@ -8,6 +8,7 @@ import { playMusicInfo, musicInfo } from '@renderer/store/player/state'
import { throttle } from '@common/utils'
import { pause, play, playNext, playPrev } from '@renderer/core/player'
import { playProgress } from '@renderer/store/player/playProgress'
import { appSetting } from '@renderer/store/setting'
export default () => {
// const setVisibleDesktopLyric = useCommit('setVisibleDesktopLyric')
@ -126,6 +127,9 @@ export default () => {
watch(() => playProgress.maxPlayTime, (newValue) => {
sendPlayerStatus({ duration: newValue })
})
watch(() => appSetting['player.playbackRate'], rate => {
sendPlayerStatus({ playbackRate: rate })
})
window.app_event.on('play', handlePlay)
window.app_event.on('pause', handlePause)
@ -163,6 +167,7 @@ export default () => {
name: musicInfo.name,
singer: musicInfo.singer,
albumName: musicInfo.album,
playbackRate: appSetting['player.playbackRate'],
picUrl: musicInfo.pic ?? '',
lyric: musicInfo.lrc ?? '',
})