背景音乐循环播放的时候报错,音乐正常播放。
unity 开发。用的微信的音频API:
代码:
if (audioBGM != null)
{
removeAudio(audioBGM, true);
}
// 长音频在使用后需要销毁
audioBGM = createAudio(false);
audioBGM.loop = true;
audioBGM.src = str;
//audioBGM.loop = true;
audioBGM.OnCanplay(() =>
{
audioBGM.Play();
});
// 自动播放停止
audioBGM.OnEnded(() =>
{
audioBGM = null;
});
// 手动停止
audioBGM.OnStop(() =>
{
audioBGM = null;
});
报错信息:Object {errMsg: "operateAudio:fail:audio is playing, don't play again", errCode: -1}
at V.formatMsg (wagame://servicewechat.com/WAGameVConsole.html:1:46398)
at new V (wagame://servicewechat.com/WAGameVConsole.html:1:43388)
at N.insertSync (wagame://servicewechat.com/WAGameVConsole.html:7:11627)
at wagame://servicewechat.com/WAGameVConsole
就安卓设备报错,ios不报错。