开发者

Android VideoView - Detect point of time in video

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜