/** @hide */ protected int setProgress() { if (mPlayer == null || mDragging) { return 0; } int position = mPlayer.getCurrentPosition(); int duration = mPlayer.getDuration(); /// M: add log for seldom ALPS01020394. @{ MmsLog.d( "MmsMediaController", "setProgress, position: " + position + ", duration: " + duration); /// @} if (mProgress != null) { if (duration > 0) { // use long to avoid overflow long pos = 1000L * position / duration; mProgress.setProgress((int) pos); } int percent = mPlayer.getBufferPercentage(); mProgress.setSecondaryProgress(percent * 10); } if (mEndTime != null) mEndTime.setText(stringForTime(duration)); if (mCurrentTime != null) mCurrentTime.setText(stringForTime(position)); // If duration is short, refresh every 100ms if (duration < 10000) { return 900; } return position; }
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) { if (!fromuser) { // We're not interested in programmatically generated changes to // the progress bar's position. return; } long duration = mPlayer.getDuration(); long newposition = (duration * progress) / 1000L; mPlayer.seekTo((int) newposition); if (mCurrentTime != null) mCurrentTime.setText(stringForTime((int) newposition)); }
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) { if (!fromuser) { // We're not interested in programmatically generated changes to // the progress bar's position. return; } duration = mPlayer.getDuration(); newposition = (duration * progress) / 1000L; // Implement Trackball event if (!mDragging) { mPlayer.seekTo((int) newposition); setProgress(); updatePausePlay(); show(sDefaultTimeout); mHandler.sendEmptyMessage(SHOW_PROGRESS); } if (mCurrentTime != null) mCurrentTime.setText(stringForTime((int) newposition)); }
private int setProgress() { if (mPlayer == null || mDragging) { return 0; } int position = mPlayer.getCurrentPosition(); int duration = mPlayer.getDuration(); if (mProgress != null) { if (duration > 0) { // use long to avoid overflow long pos = 1000L * position / duration; mProgress.setProgress((int) pos); } int percent = mPlayer.getBufferPercentage(); mProgress.setSecondaryProgress(percent * 10); } if (mEndTime != null) mEndTime.setText(stringForTime(duration)); if (mCurrentTime != null) mCurrentTime.setText(stringForTime(position)); return position; }
private long setProgress() { if (mPlayer == null || mDragging) return 0; long position = mPlayer.getCurrentPosition(); long duration = mPlayer.getDuration(); if (mProgress != null) { if (duration > 0) { long pos = 1000L * position / duration; mProgress.setProgress((int) pos); } int percent = mPlayer.getBufferPercentage(); mProgress.setSecondaryProgress(percent * 10); } mDuration = duration; if (mEndTime != null) mEndTime.setText(generateTime(mDuration)); if (mCurrentTime != null) mCurrentTime.setText(generateTime(position)); return position; }
public void onStartTrackingTouch(SeekBar bar) { show(3600000); duration = mPlayer.getDuration(); }