修复歌曲URL过期时,等待刷新URL的自动切换歌曲时间间隔太短的问题
parent
95f38e8048
commit
3cb0a56647
|
@ -2,3 +2,4 @@
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
- 修复有歌词翻译与无歌词的音乐间切换会导致歌词翻译残留显示的问题
|
- 修复有歌词翻译与无歌词的音乐间切换会导致歌词翻译残留显示的问题
|
||||||
|
- 修复歌曲URL过期时,等待刷新URL的自动切换歌曲时间间隔太短的问题
|
||||||
|
|
|
@ -373,7 +373,8 @@ export default {
|
||||||
this.addDelayNextTimeout()
|
this.addDelayNextTimeout()
|
||||||
})
|
})
|
||||||
audio.addEventListener('loadeddata', () => {
|
audio.addEventListener('loadeddata', () => {
|
||||||
// console.log('loadeddata')
|
console.log('loadeddata')
|
||||||
|
this.clearLoadingTimeout()
|
||||||
this.status = this.statusText = this.$t('core.player.loading')
|
this.status = this.statusText = this.$t('core.player.loading')
|
||||||
this.maxPlayTime = audio.duration
|
this.maxPlayTime = audio.duration
|
||||||
if (window.restorePlayInfo) {
|
if (window.restorePlayInfo) {
|
||||||
|
@ -388,8 +389,8 @@ export default {
|
||||||
if (!this.targetSong.interval && this.listId != 'download') this.updateMusicInfo({ id: this.listId, index: this.playIndex, data: { interval: formatPlayTime2(this.maxPlayTime) } })
|
if (!this.targetSong.interval && this.listId != 'download') this.updateMusicInfo({ id: this.listId, index: this.playIndex, data: { interval: formatPlayTime2(this.maxPlayTime) } })
|
||||||
})
|
})
|
||||||
audio.addEventListener('loadstart', () => {
|
audio.addEventListener('loadstart', () => {
|
||||||
// console.log('loadstart')
|
console.log('loadstart')
|
||||||
this.startBuffering()
|
this.startLoadingTimeout()
|
||||||
this.status = this.statusText = this.$t('core.player.loading')
|
this.status = this.statusText = this.$t('core.player.loading')
|
||||||
})
|
})
|
||||||
audio.addEventListener('canplay', () => {
|
audio.addEventListener('canplay', () => {
|
||||||
|
@ -399,9 +400,8 @@ export default {
|
||||||
this.mediaBuffer.playTime = 0
|
this.mediaBuffer.playTime = 0
|
||||||
audio.currentTime = playTime
|
audio.currentTime = playTime
|
||||||
}
|
}
|
||||||
if (this.mediaBuffer.timeout) {
|
|
||||||
this.clearBufferTimeout()
|
this.clearBufferTimeout()
|
||||||
}
|
|
||||||
// if (this.musicInfo.lrc) window.lrc.play(audio.currentTime * 1000)
|
// if (this.musicInfo.lrc) window.lrc.play(audio.currentTime * 1000)
|
||||||
this.status = this.statusText = ''
|
this.status = this.statusText = ''
|
||||||
})
|
})
|
||||||
|
@ -412,6 +412,7 @@ export default {
|
||||||
// })
|
// })
|
||||||
audio.addEventListener('emptied', () => {
|
audio.addEventListener('emptied', () => {
|
||||||
this.mediaBuffer.playTime = 0
|
this.mediaBuffer.playTime = 0
|
||||||
|
this.clearLoadingTimeout()
|
||||||
this.clearBufferTimeout()
|
this.clearBufferTimeout()
|
||||||
|
|
||||||
// console.log('媒介资源元素突然为空,网络错误 or 切换歌曲?')
|
// console.log('媒介资源元素突然为空,网络错误 or 切换歌曲?')
|
||||||
|
@ -796,8 +797,20 @@ export default {
|
||||||
// console.log(e)
|
// console.log(e)
|
||||||
this.isActiveTransition = false
|
this.isActiveTransition = false
|
||||||
},
|
},
|
||||||
|
startLoadingTimeout() {
|
||||||
|
// console.log('start load timeout')
|
||||||
|
this.loadingTimeout = setTimeout(() => {
|
||||||
|
this.handleNext()
|
||||||
|
}, 10000)
|
||||||
|
},
|
||||||
|
clearLoadingTimeout() {
|
||||||
|
if (!this.loadingTimeout) return
|
||||||
|
// console.log('clear load timeout')
|
||||||
|
clearTimeout(this.loadingTimeout)
|
||||||
|
this.loadingTimeout = null
|
||||||
|
},
|
||||||
startBuffering() {
|
startBuffering() {
|
||||||
console.log('start t')
|
console.error('start t')
|
||||||
if (this.mediaBuffer.timeout) return
|
if (this.mediaBuffer.timeout) return
|
||||||
this.mediaBuffer.timeout = setTimeout(() => {
|
this.mediaBuffer.timeout = setTimeout(() => {
|
||||||
this.mediaBuffer.timeout = null
|
this.mediaBuffer.timeout = null
|
||||||
|
|
Loading…
Reference in New Issue