I have two issues I would like understand.
I am using soundPool
for my sound effects and its working with no problem.
However, when I try to play cetain file (25 sec , about 400K) it doesn't play the whole file only 3-4 seconds from it .
Why and how can I fix it ?
and the second question is, should I play each effect from thread ? many threads are good ?
this is the current code :
static void play(final int soundID ){
if(loaded){
handler.post(new Runnable()
{
public void run()
{
soundpool.play(soundID, 1, 1, 1, 0, 1);
}
});
My understanding is that SoundPool
cannot be used for sounds longer than several seconds or audio files >1MB. Use MediaPlayer
in those cases.
Either use this for each play of a sound:
MediaPlayer.create(YourActivity.this, R.raw.your_sound).start();
or create MediaPlayer
object, play same sound as many times as needed, then release()
the object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With