修复禁用切歌时歌曲播放完毕后的歌曲信息显示问题
parent
399208429d
commit
1db54195f5
|
@ -5,6 +5,7 @@
|
||||||
- 修复Linux arm64系统下无法启动的问题(#1102)
|
- 修复Linux arm64系统下无法启动的问题(#1102)
|
||||||
- 修复桌面歌词使用斜体出现截断的问题(#1106)
|
- 修复桌面歌词使用斜体出现截断的问题(#1106)
|
||||||
- 修复某些情况下歌词的滚动问题
|
- 修复某些情况下歌词的滚动问题
|
||||||
|
- 修复禁用切歌时歌曲播放完毕后的歌曲信息显示问题
|
||||||
|
|
||||||
### 优化
|
### 优化
|
||||||
|
|
||||||
|
|
|
@ -142,9 +142,11 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
window.app_event.on('musicToggled', updateMusicInfo)
|
||||||
window.app_event.on('lyricUpdated', updateMusicInfo)
|
window.app_event.on('lyricUpdated', updateMusicInfo)
|
||||||
})
|
})
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
window.app_event.off('musicToggled', updateMusicInfo)
|
||||||
window.app_event.off('lyricUpdated', updateMusicInfo)
|
window.app_event.off('lyricUpdated', updateMusicInfo)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -126,12 +126,11 @@ const handleRestorePlay = async(restorePlayInfo: LX.Player.SavedPlayInfo) => {
|
||||||
rlrc: lyricInfo.rlyric,
|
rlrc: lyricInfo.rlyric,
|
||||||
rawlrc: lyricInfo.rawlrcInfo.lyric,
|
rawlrc: lyricInfo.rawlrcInfo.lyric,
|
||||||
})
|
})
|
||||||
|
window.app_event.lyricUpdated()
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
if (musicInfo.id != playMusicInfo.musicInfo?.id) return
|
if (musicInfo.id != playMusicInfo.musicInfo?.id) return
|
||||||
setAllStatus(window.i18n.t('lyric__load_error'))
|
setAllStatus(window.i18n.t('lyric__load_error'))
|
||||||
}).finally(() => {
|
|
||||||
window.app_event.lyricUpdated()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (appSetting['player.togglePlayMethod'] == 'random') addPlayedList({ ...playMusicInfo as LX.Player.PlayMusicInfo })
|
if (appSetting['player.togglePlayMethod'] == 'random') addPlayedList({ ...playMusicInfo as LX.Player.PlayMusicInfo })
|
||||||
|
@ -161,7 +160,7 @@ const handlePlay = () => {
|
||||||
|
|
||||||
if (appSetting['player.togglePlayMethod'] == 'random' && !playMusicInfo.isTempPlay) addPlayedList({ ...(playMusicInfo as LX.Player.PlayMusicInfo) })
|
if (appSetting['player.togglePlayMethod'] == 'random' && !playMusicInfo.isTempPlay) addPlayedList({ ...(playMusicInfo as LX.Player.PlayMusicInfo) })
|
||||||
|
|
||||||
void setMusicUrl(musicInfo)
|
setMusicUrl(musicInfo)
|
||||||
|
|
||||||
void getPicPath({ musicInfo, listId: playMusicInfo.isTempPlay ? null : playMusicInfo.listId }).then((url: string) => {
|
void getPicPath({ musicInfo, listId: playMusicInfo.isTempPlay ? null : playMusicInfo.listId }).then((url: string) => {
|
||||||
if (musicInfo.id != playMusicInfo.musicInfo?.id) return
|
if (musicInfo.id != playMusicInfo.musicInfo?.id) return
|
||||||
|
@ -178,12 +177,11 @@ const handlePlay = () => {
|
||||||
rlrc: lyricInfo.rlyric,
|
rlrc: lyricInfo.rlyric,
|
||||||
rawlrc: lyricInfo.rawlrcInfo.lyric,
|
rawlrc: lyricInfo.rawlrcInfo.lyric,
|
||||||
})
|
})
|
||||||
|
window.app_event.lyricUpdated()
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
if (musicInfo.id != playMusicInfo.musicInfo?.id) return
|
if (musicInfo.id != playMusicInfo.musicInfo?.id) return
|
||||||
setAllStatus(window.i18n.t('lyric__load_error'))
|
setAllStatus(window.i18n.t('lyric__load_error'))
|
||||||
}).finally(() => {
|
|
||||||
window.app_event.lyricUpdated()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,11 +219,17 @@ export const playNext = async(isAutoToggle = false): Promise<void> => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playMusicInfo.musicInfo == null) return handleToggleStop()
|
if (playMusicInfo.musicInfo == null) {
|
||||||
|
handleToggleStop()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// console.log(playInfo.playerListId)
|
// console.log(playInfo.playerListId)
|
||||||
const currentListId = playInfo.playerListId
|
const currentListId = playInfo.playerListId
|
||||||
if (!currentListId) return handleToggleStop()
|
if (!currentListId) {
|
||||||
|
handleToggleStop()
|
||||||
|
return
|
||||||
|
}
|
||||||
const currentList = getList(currentListId)
|
const currentList = getList(currentListId)
|
||||||
|
|
||||||
if (playedList.length) { // 移除已播放列表内不存在原列表的歌曲
|
if (playedList.length) { // 移除已播放列表内不存在原列表的歌曲
|
||||||
|
@ -263,7 +267,10 @@ export const playNext = async(isAutoToggle = false): Promise<void> => {
|
||||||
playerMusicInfo: currentList[playInfo.playerPlayIndex],
|
playerMusicInfo: currentList[playInfo.playerPlayIndex],
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!filteredList.length) return handleToggleStop()
|
if (!filteredList.length) {
|
||||||
|
handleToggleStop()
|
||||||
|
return
|
||||||
|
}
|
||||||
// let currentIndex: number = filteredList.indexOf(currentList[playInfo.playerPlayIndex])
|
// let currentIndex: number = filteredList.indexOf(currentList[playInfo.playerPlayIndex])
|
||||||
if (playerIndex == -1 && filteredList.length) playerIndex = 0
|
if (playerIndex == -1 && filteredList.length) playerIndex = 0
|
||||||
let nextIndex = playerIndex
|
let nextIndex = playerIndex
|
||||||
|
@ -309,10 +316,16 @@ export const playNext = async(isAutoToggle = false): Promise<void> => {
|
||||||
* 上一曲
|
* 上一曲
|
||||||
*/
|
*/
|
||||||
export const playPrev = async(isAutoToggle = false): Promise<void> => {
|
export const playPrev = async(isAutoToggle = false): Promise<void> => {
|
||||||
if (playMusicInfo.musicInfo == null) return handleToggleStop()
|
if (playMusicInfo.musicInfo == null) {
|
||||||
|
handleToggleStop()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const currentListId = playInfo.playerListId
|
const currentListId = playInfo.playerListId
|
||||||
if (!currentListId) return handleToggleStop()
|
if (!currentListId) {
|
||||||
|
handleToggleStop()
|
||||||
|
return
|
||||||
|
}
|
||||||
const currentList = getList(currentListId)
|
const currentList = getList(currentListId)
|
||||||
|
|
||||||
if (playedList.length) {
|
if (playedList.length) {
|
||||||
|
@ -350,7 +363,10 @@ export const playPrev = async(isAutoToggle = false): Promise<void> => {
|
||||||
playedList,
|
playedList,
|
||||||
playerMusicInfo: currentList[playInfo.playerPlayIndex],
|
playerMusicInfo: currentList[playInfo.playerPlayIndex],
|
||||||
})
|
})
|
||||||
if (!filteredList.length) return handleToggleStop()
|
if (!filteredList.length) {
|
||||||
|
handleToggleStop()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// let currentIndex = filteredList.indexOf(currentList[playInfo.playerPlayIndex])
|
// let currentIndex = filteredList.indexOf(currentList[playInfo.playerPlayIndex])
|
||||||
if (playerIndex == -1 && filteredList.length) playerIndex = 0
|
if (playerIndex == -1 && filteredList.length) playerIndex = 0
|
||||||
|
@ -398,7 +414,7 @@ export const playPrev = async(isAutoToggle = false): Promise<void> => {
|
||||||
export const play = () => {
|
export const play = () => {
|
||||||
if (playMusicInfo.musicInfo == null) return
|
if (playMusicInfo.musicInfo == null) return
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
void setMusicUrl(playMusicInfo.musicInfo)
|
setMusicUrl(playMusicInfo.musicInfo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setPlay()
|
setPlay()
|
||||||
|
|
|
@ -61,7 +61,7 @@ export default () => {
|
||||||
const setProgress = (time: number, maxTime?: number) => {
|
const setProgress = (time: number, maxTime?: number) => {
|
||||||
if (!musicInfo.id) return
|
if (!musicInfo.id) return
|
||||||
console.log('setProgress', time, maxTime)
|
console.log('setProgress', time, maxTime)
|
||||||
restorePlayTime = time
|
if (time > 0) restorePlayTime = time
|
||||||
if (mediaBuffer.playTime) {
|
if (mediaBuffer.playTime) {
|
||||||
clearBufferTimeout()
|
clearBufferTimeout()
|
||||||
mediaBuffer.playTime = time
|
mediaBuffer.playTime = time
|
||||||
|
@ -106,12 +106,6 @@ export default () => {
|
||||||
const handleLoadeddata = () => {
|
const handleLoadeddata = () => {
|
||||||
setMaxplayTime(getDuration())
|
setMaxplayTime(getDuration())
|
||||||
|
|
||||||
console.log('handleLoadeddata', restorePlayTime)
|
|
||||||
if (restorePlayTime) {
|
|
||||||
setCurrentTime(restorePlayTime)
|
|
||||||
restorePlayTime = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playMusicInfo.musicInfo && 'source' in playMusicInfo.musicInfo && !playMusicInfo.musicInfo.interval) {
|
if (playMusicInfo.musicInfo && 'source' in playMusicInfo.musicInfo && !playMusicInfo.musicInfo.interval) {
|
||||||
console.log(formatPlayTime2(playProgress.maxPlayTime))
|
console.log(formatPlayTime2(playProgress.maxPlayTime))
|
||||||
|
|
||||||
|
@ -128,12 +122,15 @@ export default () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCanplay = () => {
|
const handleCanplay = () => {
|
||||||
console.log('handleCanplay', mediaBuffer.playTime)
|
console.log('handleCanplay', mediaBuffer.playTime, restorePlayTime)
|
||||||
clearBufferTimeout()
|
clearBufferTimeout()
|
||||||
if (mediaBuffer.playTime) {
|
if (mediaBuffer.playTime) {
|
||||||
let playTime = mediaBuffer.playTime
|
let playTime = mediaBuffer.playTime
|
||||||
mediaBuffer.playTime = 0
|
mediaBuffer.playTime = 0
|
||||||
setCurrentTime(playTime)
|
setCurrentTime(playTime)
|
||||||
|
} else if (restorePlayTime) {
|
||||||
|
setCurrentTime(restorePlayTime)
|
||||||
|
restorePlayTime = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleWating = () => {
|
const handleWating = () => {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {
|
||||||
setAllStatus,
|
setAllStatus,
|
||||||
addPlayedList,
|
addPlayedList,
|
||||||
clearPlayedList,
|
clearPlayedList,
|
||||||
resetPlayerMusicInfo,
|
// resetPlayerMusicInfo,
|
||||||
} from '@renderer/store/player/action'
|
} from '@renderer/store/player/action'
|
||||||
|
|
||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
|
@ -68,9 +68,12 @@ export default () => {
|
||||||
}
|
}
|
||||||
const handleEnded = () => {
|
const handleEnded = () => {
|
||||||
// setTimeout(() => {
|
// setTimeout(() => {
|
||||||
if (window.lx.isPlayedStop) return setAllStatus(t('player__end'))
|
if (window.lx.isPlayedStop) {
|
||||||
resetPlayerMusicInfo()
|
setAllStatus(t('player__end'))
|
||||||
window.app_event.stop()
|
return
|
||||||
|
}
|
||||||
|
// resetPlayerMusicInfo()
|
||||||
|
// window.app_event.stop()
|
||||||
setAllStatus(t('player__end'))
|
setAllStatus(t('player__end'))
|
||||||
void playNext(true)
|
void playNext(true)
|
||||||
// })
|
// })
|
||||||
|
|
Loading…
Reference in New Issue