protected void tryToPrepare ( ) { Log . d ( TAG , "tryToPrepare" ) ; if ( this . surfaceIsReady && this . videoIsReady ) { if ( this . mediaPlayer != null && this . mediaPlayer . getVideoWidth ( ) != 0 && this . mediaPlayer . getVideoHeight ( ) != 0 ) { this . initialMovieWidth = this . mediaPlayer . getVideoWidth ( ) ; this . initialMovieHeight = this . mediaPlayer . getVideoHeight ( ) ; } resize ( ) ; stopLoading ( ) ; currentState = State . PREPARED ; if ( shouldAutoplay ) start ( ) ; if ( this . preparedListener != null ) this . preparedListener . onPrepared ( mediaPlayer ) ; } }
Try to call state PREPARED Only if SurfaceView is already created and MediaPlayer is prepared Video is loaded and is ok to play .