Skip to content

Commit

Permalink
fix: cannot change play audio when quietUpdate was used #157
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Sep 19, 2020
1 parent ade1774 commit d5bf3b1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,14 +830,12 @@ export default class ReactJkMusicPlayer extends PureComponent {
)
this.props.onPlayIndexChange && this.props.onPlayIndexChange(playIndex)

if (!this.checkCurrentPlayingAudioIsInUpdatedAudioLists()) {
switch (typeof musicSrc) {
case 'function':
musicSrc().then(loadAudio, this.onAudioError)
break
default:
loadAudio(musicSrc)
}
switch (typeof musicSrc) {
case 'function':
musicSrc().then(loadAudio, this.onAudioError)
break
default:
loadAudio(musicSrc)
}
}

Expand Down Expand Up @@ -1261,7 +1259,6 @@ export default class ReactJkMusicPlayer extends PureComponent {

// 如果删除歌曲或其他原因导致列表为空时
// 这时候会触发 https://developer.mozilla.org/en-US/docs/Web/API/MediaError
// appendAudio 时也会触发一次 error 需要判断 musicSrc 存在的情况才执行 handlePlay
if (musicSrc) {
// 如果当前音乐加载出错 尝试播放下一首
if (loadAudioErrorPlayNext && audioLists.length) {
Expand Down

0 comments on commit d5bf3b1

Please sign in to comment.