我想在Android studio中播放视频时在特定时间点显示按钮,那么我将如何跟踪视频播放时间
答案 0 :(得分:0)
public void onPrepared(MediaPlayer mediaPlayer) {
mVideoView2.start();
loadJSONFromAsset();
duration = mVideoView2.getDuration();
current = mVideoView2.getCurrentPosition();
// TextView textView = (TextView) findViewById(R.id.textView_currentPosion);
textCurrentPosition.setText(String.valueOf(current));
//textCurrentPosition.setText(duration);
Log.d("Current Location", String.valueOf(current));
if (current > 2000 && current < 9000) {
buttonPause.setVisibility(View.VISIBLE);
} else {
buttonPause.setVisibility(View.GONE);
}
}
});