myVideoView.setVideoPath(filePath);
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.seekTo(startTImeData[0]* 1000);
myVideoView.start();
Handler handler = new Handler();
handler.postDelayed(stopPlayerTask, endTimeData[0] * 1000);
}
Runnable stopPlayerTask = new Runnable() {
@Override
public void run() {
trackingVideoPlayTime();
}
};
public void trackingVideoPlayTime(){
// this will always till video play ... update time according to need if required update it to second by second or min or hour
int playTime = myVideoView.getCurrentPosition()/1000;
Q
// comparing playtime with start_skip_time.length
int a=1;
while(a>startTImeData.length){
if(playTime==startTImeData[a]){
myVideoView.stopPlayback();
myVideoView.seekTo(endTimeData[a]* 1000);
myVideoView.start();
// play again at given time
return;
} else {
// do nothing
}
a++;
}
}
这是我的代码我试图从主视频播放视频,其长度为20秒,特定时间从2-4和8-9仅表示2秒视频但是当我尝试使用我的代码实现时它不工作播放时间总是给出主视频大小请告诉我哪里出错了。