Hello friends,
I am developing an app using phonegap for android. It consists of
around 25 images and similar number of mp3 files. Each mp3 file has
duration not more than 10 seconds. The requirement of app is whenever
a image is shown on screen its related mp3 file should be played. I am
using jqtouch swipe action to move from one page to another. I am
facing following problems both on emulator and real device(samsung
galaxy 3)-
1. After playing 15-20 mp3 files sound stops playing both on
emulator and galaxy 3. In logcat I got following error
ERROR/AudioFlinger(34): not enough memory for AudioTrack
size=49216
I am using following code to play mp3 files
if(mp3file!=null){
mp3file.stop();
mp3file = null;
}
mp3file = new Media("/android_asset/www/name_of_file.mp3",
function() {
console.log("playAudio():Audio Success");
},
function(err) {
},
function(status) {
});
mp3file.play();
I think error is due to audiomanager objects from phonegap api of each
mp3 file remaining in memory. I want to know how to destroy media
object created in javascript. You can play, stop, pause. But is there
any method in phonegap for android to destroy it so that it does not
remain in memory after it has done playing.
2. Another problem that I am facing is related with left swipe
action in jqtouch to view next image. If I am currently viewing image1
and if I try to view image2 by left swipe action, image2 is shown for
short amount of time and after that image1 is shown for a moment and
after that again image2 is shown. In short the transition from image1
to image2 is not smooth and it has flickering effects. However if i go
from image2 to image1 using right swipe transition is smooth.
Should I turn to native coding in android instead of doing in phonegap
for this type of app involving large number of sound files.
Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en