I have tried to simplify the process  Based  on the cycle of
100 ms play 100ms pause , etc...

handle = new Handler();
play   = new Runnable() {
   @Override  
   public void run() {  
        if (mMediaPlayer != null) {
            mMediaPlayer.setLooping(false);
            if (mMediaPlayer.isPlaying() )   mMediaPlayer.pause();  
            else                             mMediaPlayer.start(); 

            if (mMediaPlayer.getCurrentPosition() < (mMediaPlayer.getDuration() 
- 5))
            handle.postDelayed(this, MaxDelay);
        }
   }
};
play.run();


Where MaxDelay can be changed using a SeekBar.

This does slow it down, but it can appear very  jerky
any ideas how we can still slow down and lose the jerkiness ?

Thanks  again



On Jun 30, 2011, at 4:56 AM, Daniel Drozdzewski wrote:

> On Thu, Jun 30, 2011 at 12:35 AM, Indicator Veritatis <[email protected]> 
> wrote:
>> I don't use TimerTask in Java. For reasons that were never 100% clear
>> to me, the online docs for the JDK and other sources recommend using a
>> Handler instead. There is even an example in code in the docs for
>> Handler somewhere, but as I write this, I can only find a similar one
>> at http://www.muktosoft.com/timer-in-android-the-better-way/, also a
>> good source.
>> 
>> But if you really want to use a TimerTask, see
>> http://developer.android.com/resources/articles/timed-ui-updates.html
> 
> Indicator,
> 
> It is a fair comment, that in such case, using Handler is a lighter solutions.
> 
> One thing from the article from the second link you posted intrigued me:
> 
> 'When I ported the application to use the Android SDKs, this code
> actually compiled in Eclipse, but failed with a runtime error because
> the Timer() class was not available at runtime (fortunately, this was
> easy to figure out from the error messages). On a related note, the
> String.format method was also not available, so the eventual solution
> uses a quick hack to format the seconds nicely as you will see.'
> 
> Timer() or String.format() not available at runtime... Not standard
> Android there? Both Timer() and String.format() have been in Android
> SDK since version 1.
> 
> The article comes from Dick Wall, who is quite an authority in my
> opinion, when it comes to Java.
> 
> 
> Daniel
> 
> -- 
> 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

-- 
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

Reply via email to