On Thu, May 7, 2009 at 10:33 PM, Sudha <sudhaker...@gmail.com> wrote:

>
> I have nearly 28 sound files in which most of them have the duration
> less than a second (i.e in milliseconds), to reduce the delay in
> creating the player everytime, i created a player for each sound file
> i.e 28 MediaPlayers and each sound file plays on its own player and
> all the sounds are managed by a separate single thread (FYI only that
> sound thread can call these methods no other thread can start the
> sounds explicitly), so I can confirm that all the methos calling is
> done by a single thread.


I would suggest using SoundPool instead. 28 MediaPlayers is a bit much.

and regarding the other code, i have posted all what am using and the
> only other thing which is not here is the constructor which converts
> the given input stream to a file as the MediaPlayer cannot play sounds
> directly with a stream.
>
> (I am packing all the sounds in a single pack and open it at runtime
> and give the input stream to Player as it is done in J2ME, so again am
> converting the given input stream to a file.)


 You should pack these sounds as resources in your apk, and then play
them by resource id or using an AssetFileDescriptor. (you can do this
with both MediaPlayer or SoundPool)

(...)

> does the phone stop the sounds while it goes to standby mode?
> I have my own code to stop the sounds when an interrupt occurs, so
> does this conflict with the device method calls?


Unless you specifically tell the phone to stay awake (by using a partial
wakelock, for example), it may go to sleep, and will stop audio playback
while it sleeps.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to