File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
5454 // settable by the client
5555 private Uri mUri ;
5656 private Map <String , String > mHeaders ;
57- private int mDuration ;
5857
5958 // all possible internal states
6059 private static final int STATE_ERROR = -1 ;
@@ -229,7 +228,6 @@ private void openVideo() {
229228 mMediaPlayer = new MediaPlayer ();
230229 mMediaPlayer .setOnPreparedListener (mPreparedListener );
231230 mMediaPlayer .setOnVideoSizeChangedListener (mSizeChangedListener );
232- mDuration = -1 ;
233231 mMediaPlayer .setOnCompletionListener (mCompletionListener );
234232 mMediaPlayer .setOnErrorListener (mErrorListener );
235233 mMediaPlayer .setOnInfoListener (mOnInfoListener );
@@ -608,17 +606,12 @@ public void resume() {
608606 openVideo ();
609607 }
610608
611- // cache duration as mDuration for faster access
612609 public int getDuration () {
613610 if (isInPlaybackState ()) {
614- if (mDuration > 0 ) {
615- return mDuration ;
616- }
617- mDuration = mMediaPlayer .getDuration ();
618- return mDuration ;
611+ return mMediaPlayer .getDuration ();
619612 }
620- mDuration = - 1 ;
621- return mDuration ;
613+
614+ return - 1 ;
622615 }
623616
624617 public int getCurrentPosition () {
You can’t perform that action at this time.
0 commit comments