定时循环播放mp3,大概40分钟后,报错 INNERERRCODE -11800?
发布于 7 年前 作者 qianchao 9413 次浏览 来自 官方Issues

定时循环播放mp3,大概40分钟后,报错 INNERERRCODE -11800

代码:

var innerAudioContext = wx.createInnerAudioContext()

innerAudioContext.autoplay = false;

innerAudioContext.onEnded(function(e) {

if (voiceIdx >= voices.length)

return;

innerAudioContext.src = app.globalData.voiceCache[voices[voiceIdx++]];

innerAudioContext.play();

});

innerAudioContext.src = app.globalData.voiceCache[voices[voiceIdx++]];

innerAudioContext.play();

this.innerAudioContext = innerAudioContext;

运行40分钟后,小程序非常卡,报错:

开始都是正常的,一段时间之后崩了。我感觉小程序内部有内存泄露。请帮忙检查确认下。

2 回复

跟大家汇报下小程序声音内存泄露问题。网上我发现已经有很多人都遇到多,解决方案是:

this.innerAudioContext.stop();

this.innerAudioContext.destroy();

this.innerAudioContext = null;

要定期的去destroy这个context。不然这个context就算stop了,内存还是被占用。至于官方想不想改自便吧。

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部