修复无法关闭状态栏歌曲进度的问题
parent
f76f4d9d29
commit
0f5d2189e0
|
@ -62,13 +62,17 @@ export default ({ setting, playNext }) => {
|
|||
// if (!isPlay) audio.play()
|
||||
}
|
||||
|
||||
const handleSetTaskBarState = (progress, status) => {
|
||||
if (setting.value.player.isShowTaskProgess) setTaskBarProgress(progress, status)
|
||||
}
|
||||
|
||||
const handlePlay = () => {
|
||||
prevProgressStatus = 'normal'
|
||||
setTaskBarProgress(playProgress.progress, prevProgressStatus)
|
||||
handleSetTaskBarState(playProgress.progress, prevProgressStatus)
|
||||
}
|
||||
const handlePause = () => {
|
||||
prevProgressStatus = 'paused'
|
||||
setTaskBarProgress(playProgress.progress, prevProgressStatus)
|
||||
handleSetTaskBarState(playProgress.progress, prevProgressStatus)
|
||||
clearBufferTimeout()
|
||||
}
|
||||
|
||||
|
@ -76,13 +80,13 @@ export default ({ setting, playNext }) => {
|
|||
setNowPlayTime(0)
|
||||
setMaxplayTime(0)
|
||||
prevProgressStatus = 'none'
|
||||
setTaskBarProgress(playProgress.progress, prevProgressStatus)
|
||||
handleSetTaskBarState(playProgress.progress, prevProgressStatus)
|
||||
}
|
||||
|
||||
const handleError = () => {
|
||||
if (!restorePlayTime) restorePlayTime = getCurrentTime() // 记录出错的播放时间
|
||||
prevProgressStatus = 'error'
|
||||
setTaskBarProgress(playProgress.progress, prevProgressStatus)
|
||||
handleSetTaskBarState(playProgress.progress, prevProgressStatus)
|
||||
}
|
||||
|
||||
const handleLoadeddata = () => {
|
||||
|
@ -135,7 +139,7 @@ export default ({ setting, playNext }) => {
|
|||
|
||||
watch(() => playProgress.progress, (newValue, oldValue) => {
|
||||
if (newValue.toFixed(2) === oldValue.toFixed(2)) return
|
||||
setTaskBarProgress(newValue, prevProgressStatus)
|
||||
handleSetTaskBarState(newValue, prevProgressStatus)
|
||||
})
|
||||
watch(() => playProgress.nowPlayTime, (newValue, oldValue) => {
|
||||
if (Math.abs(newValue - oldValue) > 2) window.eventHub.emit(eventPlayerNames.activeTransition)
|
||||
|
|
|
@ -137,7 +137,7 @@ export const onGetDesktopLyricInfo = callback => {
|
|||
|
||||
export const setTaskBarProgress = (status, mode) => {
|
||||
rendererSend(NAMES.mainWindow.progress, {
|
||||
status: status < 0.01 ? 0.01 : status,
|
||||
status: status < 0 ? status : Math.max(0.01, status),
|
||||
mode: mode || 'normal',
|
||||
})
|
||||
}
|
||||
|
|
|
@ -47,10 +47,7 @@ export default {
|
|||
watch(() => currentStting.value.player.isShowTaskProgess, val => {
|
||||
if (val) return
|
||||
nextTick(() => {
|
||||
setTaskBarProgress({
|
||||
status: -1,
|
||||
mode: 'normal',
|
||||
})
|
||||
setTaskBarProgress(-1, 'normal')
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue