Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
826 views
in Technique[技术] by (71.8m points)

android - the seekTo() function doesn't work in VideoView

There is a problem in my application,I want to use the seekTo() function with VideoView like this:

videoView.seekTo(time);
videoView.start();

It works well in android 2.2 ,but doesn't work in android 2.3 or higher version... Some body will tell me why? It troubles me for serval days.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The call to VideoView.start() should be made only after the seek has completed. The call to VideoView.seekTo() initiates a seek but unfortunately VideoView does not support OnSeekCompleteListener needed to notify the seek is actually done.

You can customize VideoView to support OnSeekCompleteListener as shown in my answer to 7990784.

Then you can register to receive onSeekComplete() by calling setOnSeekCompleteListener(). Your implementation of the listener should then call VideoView.start().


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...