Thanks! I will try MediaPlayer.setLooping(true). With longer sounds it works just fine. I have feeling that error happens because of no sync. MediaPlayer playes and is going to stop, at this moment "seekTo" makes freeze sound problem. (Just my guess)
On Apr 23, 7:18 pm, Marco Nelissen <[email protected]> wrote: > Does it work with longer sounds? > Have you tried using MediaPlayer.setLooping(true) instead of restarting it > yourself from the OnCompletionListener callback? > > On Thu, Apr 23, 2009 at 12:00 AM, BlackLight <[email protected]>wrote: > > > > > Hello. > > > I have this task: > > Need to play short (0.3-0.4 sec) sounds all the time. When sound is > > played, it should start again, etc. User can press button to reset > > sound - it should stop and lunch. > > > I did many tests. I tried to create 1 MediaPlayer, then do this: > > MediaPlayer.OnCompletionListener complListener = new > > MediaPlayer.OnCompletionListener() > > { > > public void onCompletion(MediaPlayer mp) { > > lunchSound(); // "rewind" > > } > > }; > > > private boolean lunchSound() > > { > > try > > { > > mplayer.seekTo(0); // move to start > > mplayer.start(); > > return true; > > }catch(Exception e){} > > return false; > > } > > When user press button, I call lunchSound(); > > > It works great on emulator and on device if I have eclipse+debugger > > on. > > When I disconnect debugger, I have very strange errors - sound can > > stop at all (till program restart), sound can start "repeating" (play > > 0.1-0.2 sec, then restart). Can someone please provide me some info > > about problem? > > 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 -~----------~----~----~----~------~----~------~--~---

