Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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.
JavaScript
<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.
Posted
v3
Comments
Sergey Alexandrovich Kryukov 1-Jun-14 13:42pm    
What piece of documentation do you refer to?
—SA
Jeek_online 1-Jun-14 23:24pm    
@SA: Thanks for reply, I referred here : http://www.tricedesigns.com/2012/01/25/low-latency-polyphonic-audio-in-phonegap/
Sergey Alexandrovich Kryukov 1-Jun-14 23:48pm    
Thank you; I'll take a look...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900