本文介绍了LowLatencyAudio插件:在哪里调用unload函数参考音频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在phonegap构建中使用了LowLatencyAudio插件来播放声音并且工作正常。但是,当我提到时说,卸载功能必须使用才能从内存中卸载音频文件。否则,您将导致内存泄漏。这是我的工作代码片段。
I have used LowLatencyAudio plugin in phonegap build to play sound and which works fine . But, when I referred this which says, unload function must be used in order to unload an audio file from memory. Otherwise, you will cause memory leaks. Here is my working code snippet.
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="PGLowLatencyAudio.js"></script>
<script type="text/javascript" src="main.js"></script>
<script>
var lla;
var url_start = 'sounds/startup.wav';
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady(){
if( window.plugins && window.plugin.LowLatencyAudio)
{
lla = window.plugins.LowLatencyAudio;
lla.preloadAudio(url_start, url_start, 1, success, fail);
}
}
function play_startup(){
lla.play(url_start);
}
</script>
//From main.js
play_startup();
我的问题是我需要调用卸载功能的地方吗?有没有其他方法可以避免妈妈泄密?
先谢谢。
My QUESTION is where I need to call unload function ? Is there any other way to avoid momory leaks?
Thanks in Advance.
推荐答案
这篇关于LowLatencyAudio插件:在哪里调用unload函数参考音频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!