-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当歌词为空时会有报错 #283
Comments
触发逻辑有点奇怪,偶尔会出现,都用线上资源好像就不会触发。 大概的规律第一首歌是本地资源,第二首歌是线上资源
|
@so-diao 能否给一个复现demo?codepen和jsbin抑或是jsfiddle都行 |
@Copay https://codepen.io/anon/pen/vopZVo |
对于有些歌曲没有歌词的情况,不建议直接置为空lrc: '',,这样会出现问题:一开始可能没有问题,如果设置循环,第二次时就会报错–找不到歌词。建议:添加同名歌词文件,如 |
是一个解决办法,这一步让插件做比较合适。 |
由于看起来这个包不再更新了,虽然 #284 被合并但是无法使用,下面是一个解决这个问题的 monkey patch: instance = new APlayer({
// ......
})
const _switch = instance.lrc.switch
const _update = instance.lrc.update
instance.lrc.switch = (index) => {
instance.lrc.update = () => {}
_switch.call(instance.lrc, index)
instance.lrc.update = _update
} 原理: // list.js
this.player.lrc && this.player.lrc.switch(this.index);
this.player.lrc && this.player.lrc.update(0);
// lrc 定义在 lrc.js 中,只有这一处调用
|
描述
第一首歌播放的过程中切换到第二首歌(第二首歌无歌词),将会报错。
资源
报错
Uncaught TypeError: Cannot read property 'classList' of undefined
版本
1.10.1
The text was updated successfully, but these errors were encountered: