@@ -373,7 +373,8 @@ export default {
373373 this .addDelayNextTimeout ()
374374 })
375375 audio .addEventListener (' loadeddata' , () => {
376- // console.log('loadeddata')
376+ console .log (' loadeddata' )
377+ this .clearLoadingTimeout ()
377378 this .status = this .statusText = this .$t (' core.player.loading' )
378379 this .maxPlayTime = audio .duration
379380 if (window .restorePlayInfo ) {
@@ -388,8 +389,8 @@ export default {
388389 if (! this .targetSong .interval && this .listId != ' download' ) this .updateMusicInfo ({ id: this .listId , index: this .playIndex , data: { interval: formatPlayTime2 (this .maxPlayTime ) } })
389390 })
390391 audio .addEventListener (' loadstart' , () => {
391- // console.log('loadstart')
392- this .startBuffering ()
392+ console .log (' loadstart' )
393+ this .startLoadingTimeout ()
393394 this .status = this .statusText = this .$t (' core.player.loading' )
394395 })
395396 audio .addEventListener (' canplay' , () => {
@@ -399,9 +400,8 @@ export default {
399400 this .mediaBuffer .playTime = 0
400401 audio .currentTime = playTime
401402 }
402- if (this .mediaBuffer .timeout ) {
403- this .clearBufferTimeout ()
404- }
403+ this .clearBufferTimeout ()
404+
405405 // if (this.musicInfo.lrc) window.lrc.play(audio.currentTime * 1000)
406406 this .status = this .statusText = ' '
407407 })
@@ -412,6 +412,7 @@ export default {
412412 // })
413413 audio .addEventListener (' emptied' , () => {
414414 this .mediaBuffer .playTime = 0
415+ this .clearLoadingTimeout ()
415416 this .clearBufferTimeout ()
416417
417418 // console.log('媒介资源元素突然为空,网络错误 or 切换歌曲?')
@@ -713,6 +714,7 @@ export default {
713714 this .status = this .musicInfo .name = this .musicInfo .singer = ' '
714715 this .musicInfo .songmid = null
715716 this .musicInfo .lrc = null
717+ this .musicInfo .tlrc = null
716718 this .musicInfo .url = null
717719 this .nowPlayTime = 0
718720 this .maxPlayTime = 0
@@ -795,8 +797,20 @@ export default {
795797 // console.log(e)
796798 this .isActiveTransition = false
797799 },
800+ startLoadingTimeout () {
801+ // console.log('start load timeout')
802+ this .loadingTimeout = setTimeout (() => {
803+ this .handleNext ()
804+ }, 10000 )
805+ },
806+ clearLoadingTimeout () {
807+ if (! this .loadingTimeout ) return
808+ // console.log('clear load timeout')
809+ clearTimeout (this .loadingTimeout )
810+ this .loadingTimeout = null
811+ },
798812 startBuffering () {
799- console .log (' start t' )
813+ console .error (' start t' )
800814 if (this .mediaBuffer .timeout ) return
801815 this .mediaBuffer .timeout = setTimeout (() => {
802816 this .mediaBuffer .timeout = null
@@ -891,7 +905,7 @@ export default {
891905 })
892906 },
893907 setLyric () {
894- window .lrc .setLyric ((this .setting .player .isShowLyricTransition && this .musicInfo .tlrc ? this .musicInfo .tlrc + ' \n ' : ' ' ) + this .musicInfo .lrc )
908+ window .lrc .setLyric ((this .setting .player .isShowLyricTransition && this .musicInfo .tlrc ? ( this .musicInfo .tlrc + ' \n ' ) : ' ' ) + ( this .musicInfo .lrc || ' ' ) )
895909 if (this .isPlay && (this .musicInfo .url || this .listId == ' download' )) {
896910 window .lrc .play (audio .currentTime * 1000 )
897911 this .handleUpdateWinLyricInfo (' play' , audio .currentTime * 1000 )
0 commit comments