[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-28 Thread Sudha
Hi, for now i have found a work around In onCompletionListener() am resetting the player and setting DataSource and then calling prepare() then start() so that no sounds are skipped. mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void

[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-28 Thread Sudha
Oops I tried the below code: mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { mp.stop(); isPlayingSound = false; } }); then when the same sound is requested again called

[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-27 Thread niko20
You have to call Stop() before you can call Seek(). Also you have lots of MediaPlayers which is not a good idea. I would upgrade to 1.5 cupcake SDK and use the AudioTrack classes (or soundpool maybe) -niko20 On Apr 27, 3:20 am, Sudha sudhaker...@gmail.com wrote: Hi, I have a requirement to

[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-27 Thread BlackLight
I have same problem. I tried to seek()/start() and tried to create players too. Some sounds are silent if play them often. Any idea? Sometimes sound stuck at all. No sound anymore in active Activity, but if I go to my program menu (back button) and lunch play activity again - sounds are fine. On

[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-27 Thread BlackLight
BTW: Seeks to specified time position. Call this after start(), pause(), or prepare(), or after receiving onPrepared or onCompletion event notification from OnPreparedListener or OnCompletionListener interface. No need to stop. Right? On Apr 27, 10:34 pm, niko20 nikolatesl...@yahoo.com wrote:

[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-27 Thread Dave Sparks
Try this: mp.prepare(); mp.seekTo(0); mp.start(); And get rid of your onPreparedListener. It is unnecessary since you are calling prepare(). On Apr 27, 1:20 am, Sudha sudhaker...@gmail.com wrote: Hi, I have a requirement to play several sounds many times in my game so instead of creating

[android-developers] Re: MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

2009-04-27 Thread niko20
Sorry you are right, I meant you have to pause. Worth a try anyway.. On Apr 27, 4:19 pm, Dave Sparks davidspa...@android.com wrote: Try this: mp.prepare(); mp.seekTo(0); mp.start(); And get rid of your onPreparedListener. It is unnecessary since you are calling prepare(). On Apr 27,