[0]skeleton的_onAniSoundStoped清除的时候有时会报undefined错误
/**
* @internal
* 清掉播放完成的音频
* @param force 是否强制删掉所有的声音channel
*/
private _onAniSoundStoped(force: boolean): void {
for (let len = this._soundChannelArr.length, i = 0; i < len; i++) {
let channel = this._soundChannelArr[i];
if (channel.isStopped || force) {
!channel.isStopped && channel.stop();
this._soundChannelArr.splice(i, 1);
// SoundManager.removeChannel(_channel); // TODO 是否需要? 去掉有什么好处? 是否还需要其他操作?
len--; i--;
}
}
}[/i]
[i]channel 可能为空,len和数组长度不一致导致的。参考解决方法:[url=https://github.com/layabox/LayaAir/pull/1128]FIX: 一个动作中有多个声音播放时,清除时可能导致报错 by hhm-shy · Pull Request #1128 · layabox/LayaAir (github.com)[/url][/i]
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
phhh
赞同来自: