Wednesday, June 29, 2011

Re: [android-developers] Slow motion video

On Wed, Jun 29, 2011 at 1:37 PM, New Developer <security@isscp.com> wrote:
> To Daniel
> I have tried pause no success
> can you let me know more what you were thinking  perhaps I have implemented it incorrectly ??
>
> Thanks again

Sure, I was thinking following (I have not implemented this myself mind):

<code>
MediaPlayer player;
Timer timer = new Timer();
//initialisation of the player

timer.schedule( new TimerTask() {
run() {
player.start();
}
}, 0, 200);

timer.schedule( new TimerTask() {
run() {
player.pause();
}
}, 100, 200);

</code>

You schedule 2 recurring tasks on a Timer: one to resume/start the
video every 200 milliseconds, and the second to pause it also every
200 milliseconds, with 100 millisecond offset. This should slow the
playback by the factor of 2. You can adjust the numbers to get
different ratios and I would not play or pause for longer than say 500
milliseconds, as it will look jerky.

It is possible that both timers will diverge (no real-time promise),
in which case you will have to do something a bit more clever than
arbitrary numbers, as the paused_time / play_time ratio will shift.

You will probably need to monitor actual track progress by using
MediaPlayer.getCurrentPosition(), rather than the inaccurate wall
clock.

Daniel


>
>
> On Jun 12, 2011, at 3:52 AM, Daniel Drozdzewski wrote:
^^^^^^^^^^^^^^^----- Internet got very slow or The Matrix is
overloaded (could not resist)

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment