@Override protected void initViews() { mControllerTopView = (RelativeLayout) findViewById(R.id.controller_top_layout); mBackLayout = (RelativeLayout) findViewById(R.id.back_layout); mTitleTextView = (TextView) findViewById(R.id.title_text_view); mControllerBottomView = (RelativeLayout) findViewById(R.id.controller_bottom_layout); mSeekBar = (MediaPlayerVideoSeekBar) findViewById(R.id.seekbar_video_progress); mPlaybackImageView = (ImageView) findViewById(R.id.video_playback_image_view); mCurrentTimeTextView = (TextView) findViewById(R.id.short_video_small_current_time_tv); mTotalTimeTextView = (TextView) findViewById(R.id.short_video_small_duration_time_tv); mSeekBar.setMax(MAX_VIDEO_PROGRESS); mSeekBar.setProgress(0); }
public void updateVideoProgress(float percentage) { if (percentage >= 0 && percentage <= 1) { int progress = (int) (percentage * mSeekBar.getMax()); if (!mVideoProgressTrackingTouch) mSeekBar.setProgress(progress); long curTime = mMediaPlayerController.getCurrentPosition(); long durTime = mMediaPlayerController.getDuration(); if (durTime > 0 && curTime <= durTime) { mCurrentTimeTextView.setText(MediaPlayerUtils.getVideoDisplayTime(curTime)); mTotalTimeTextView.setText(MediaPlayerUtils.getVideoDisplayTime(durTime)); } } }