diff --git a/src/common/types/player.d.ts b/src/common/types/player.d.ts index 161ef813..f4817916 100644 --- a/src/common/types/player.d.ts +++ b/src/common/types/player.d.ts @@ -24,6 +24,7 @@ declare namespace LX { picUrl: string progress: number duration: number + playbackRate: number lyricLineText: string lyric: string collect: boolean diff --git a/src/main/app.ts b/src/main/app.ts index 0b443a8b..7a485ecf 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -242,6 +242,7 @@ export const initAppSetting = async() => { picUrl: '', progress: 0, duration: 0, + playbackRate: 1, lyricLineText: '', lyric: '', collect: false, diff --git a/src/main/modules/openApi/index.ts b/src/main/modules/openApi/index.ts index 98b7db13..95c2633c 100644 --- a/src/main/modules/openApi/index.ts +++ b/src/main/modules/openApi/index.ts @@ -28,6 +28,7 @@ const handleStartServer = async(port = 9000, ip = '127.0.0.1') => new Promise) => { } 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) => { diff --git a/src/renderer/core/useApp/usePlayer/usePlayStatus.ts b/src/renderer/core/useApp/usePlayer/usePlayStatus.ts index 575168e2..08062f75 100644 --- a/src/renderer/core/useApp/usePlayer/usePlayStatus.ts +++ b/src/renderer/core/useApp/usePlayer/usePlayStatus.ts @@ -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 ?? '', })