添加播放速率

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 picUrl: string
progress: number progress: number
duration: number duration: number
playbackRate: number
lyricLineText: string lyricLineText: string
lyric: string lyric: string
collect: boolean collect: boolean

View File

@ -242,6 +242,7 @@ export const initAppSetting = async() => {
picUrl: '', picUrl: '',
progress: 0, progress: 0,
duration: 0, duration: 0,
playbackRate: 1,
lyricLineText: '', lyricLineText: '',
lyric: '', lyric: '',
collect: false, 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, duration: global.lx.player_status.duration,
progress: global.lx.player_status.progress, progress: global.lx.player_status.progress,
picUrl: global.lx.player_status.picUrl, picUrl: global.lx.player_status.picUrl,
playbackRate: global.lx.player_status.playbackRate,
lyricLineText: global.lx.player_status.lyricLineText, lyricLineText: global.lx.player_status.lyricLineText,
}) })
break break

View File

@ -187,7 +187,6 @@ export const setWindowBounds = (options: Partial<Electron.Rectangle>) => {
} }
export const setProgressBar = (progress: number, options?: Electron.ProgressBarOptions) => { export const setProgressBar = (progress: number, options?: Electron.ProgressBarOptions) => {
if (!browserWindow) return if (!browserWindow) return
console.log(progress, options)
browserWindow.setProgressBar(progress, options) browserWindow.setProgressBar(progress, options)
} }
export const setIgnoreMouseEvents = (ignore: boolean, options?: Electron.IgnoreMouseEventsOptions) => { 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 { throttle } from '@common/utils'
import { pause, play, playNext, playPrev } from '@renderer/core/player' import { pause, play, playNext, playPrev } from '@renderer/core/player'
import { playProgress } from '@renderer/store/player/playProgress' import { playProgress } from '@renderer/store/player/playProgress'
import { appSetting } from '@renderer/store/setting'
export default () => { export default () => {
// const setVisibleDesktopLyric = useCommit('setVisibleDesktopLyric') // const setVisibleDesktopLyric = useCommit('setVisibleDesktopLyric')
@ -126,6 +127,9 @@ export default () => {
watch(() => playProgress.maxPlayTime, (newValue) => { watch(() => playProgress.maxPlayTime, (newValue) => {
sendPlayerStatus({ duration: newValue }) sendPlayerStatus({ duration: newValue })
}) })
watch(() => appSetting['player.playbackRate'], rate => {
sendPlayerStatus({ playbackRate: rate })
})
window.app_event.on('play', handlePlay) window.app_event.on('play', handlePlay)
window.app_event.on('pause', handlePause) window.app_event.on('pause', handlePause)
@ -163,6 +167,7 @@ export default () => {
name: musicInfo.name, name: musicInfo.name,
singer: musicInfo.singer, singer: musicInfo.singer,
albumName: musicInfo.album, albumName: musicInfo.album,
playbackRate: appSetting['player.playbackRate'],
picUrl: musicInfo.pic ?? '', picUrl: musicInfo.pic ?? '',
lyric: musicInfo.lrc ?? '', lyric: musicInfo.lrc ?? '',
}) })