On Thu, Jun 30, 2011 at 1:05 PM, New Developer <[email protected]> wrote:
> 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();

That's because you don't change the ratio between playing time and
pause time. It is still 1 and changes only slightly when you are
moving your slider, to come back to 1, once slider has stopped.

Think of a square wave generator: 1 is play time, 0 is pause time. To
change the play speed have to change ratio between 1s and 0s rather
than the frequency of that wave.

what you have done is that the period is getting longer, but the ratio
remains the same:


010101

001100110011

000111000111

0000111100001111

...

at some point this will get jerky, if you stop it for longer than our
brain can perceive as a smooth sequence of moving pictures.

What you need is this:


<--1st cycle -><- 2nd cycle->        duration of thee cycle remains constant

111111111111111111111111...     normal speed

111111000000111111000000...     2x slow down

111000000000111000000000...     3x slow down

110000000000110000000000...     5x slow down

100000000000100000000000...     10x slow down

000000000000000000000000...     full stop


It is important to do it often enough, say within a second there
should be at least few of those cycles (I think 5 is a good number to
start with, which means your cycle should be taking
200milliseconds.This means that playing_time + pausing_time = 200msec.

Once you implement that, it should work.

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

Reply via email to