views:

143

answers:

1

Hi all,

I am using a VideoView to display a video. I am using setOnPreparedListener and setOnCompletionListener to do stuff before and after the video starts and ends.

I was wondering how I could go about detecting some point of time in the video. For eg, say I want to write log to a file when the video has played for 10s. How can I detect the 10s mark?

Thanks Chris

A: 

Step #1: Use postDelayed() or something to get control every second or so.

Step #2: Check getCurrentPosition() and see if it is near your desired marker point. If so, do your processing.

Step #3: Lather, rinse, repeat.

There is no mechanism for Android to call into you specifically when a certain point in time has occurred in the video, so you have to make do with a polling mechanism.

CommonsWare
from my experience this works to a certain point, but it is not very accurate. Maybe +/- 500ms
justinl