有没有办法在视频 View 中播放的视频的特定位置启动方法?
我唯一想到的是:
while(ture)
{
if(videoview.getCurrentPosition==Position)
{
//do something
}
}
最佳答案
在高层次上,这几乎就是您要结束的。
从效率的角度来看,您的建议不会奏效。这样的事情对设备的影响要小得多:
Runnable thePollingLogic=new Runnable() {
public void run() {
if (yourVideoView.getCurrentPosition()>=theMagicPosition) {
// do something
}
yourVideoView.postDelayed(this, 1);
}
这将检查您的位置,然后在约 1 毫秒内不再运行。您需要做的就是在开始播放视频后调用 thePollingLogic.run()
,然后在不再需要轮询时调用 yourVideoView.removeCallbacks(thePollingLogic)
循环。
关于android - videoview特定位置的launch方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20442305/