protected void initObjects ( ) { Log . d ( TAG , "initObjects" ) ; if ( this . mediaPlayer == null ) { this . mediaPlayer = new MediaPlayer ( ) ; this . mediaPlayer . setOnInfoListener ( this ) ; this . mediaPlayer . setOnErrorListener ( this ) ; this . mediaPlayer . setOnPreparedListener ( this ) ; this . mediaPlayer . setOnCompletionListener ( this ) ; this . mediaPlayer . setOnSeekCompleteListener ( this ) ; this . mediaPlayer . setOnBufferingUpdateListener ( this ) ; this . mediaPlayer . setOnVideoSizeChangedListener ( this ) ; this . mediaPlayer . setAudioStreamType ( AudioManager . STREAM_MUSIC ) ; } RelativeLayout . LayoutParams layoutParams ; View view ; if ( android . os . Build . VERSION . SDK_INT >= Build . VERSION_CODES . ICE_CREAM_SANDWICH ) { if ( this . textureView == null ) { this . textureView = new TextureView ( this . context ) ; this . textureView . setSurfaceTextureListener ( this ) ; } view = this . textureView ; } else { if ( this . surfaceView == null ) { this . surfaceView = new SurfaceView ( context ) ; } view = this . surfaceView ; if ( this . surfaceHolder == null ) { this . surfaceHolder = this . surfaceView . getHolder ( ) ; //noinspection deprecation this . surfaceHolder . setType ( SurfaceHolder . SURFACE_TYPE_PUSH_BUFFERS ) ; this . surfaceHolder . addCallback ( this ) ; } } layoutParams = new RelativeLayout . LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . MATCH_PARENT ) ; layoutParams . addRule ( CENTER_IN_PARENT ) ; view . setLayoutParams ( layoutParams ) ; addView ( view ) ; // Try not reset onProgressView if ( this . onProgressView == null ) this . onProgressView = new ProgressBar ( context ) ; layoutParams = new RelativeLayout . LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT ) ; layoutParams . addRule ( CENTER_IN_PARENT ) ; this . onProgressView . setLayoutParams ( layoutParams ) ; addView ( this . onProgressView ) ; stopLoading ( ) ; this . currentState = State . IDLE ; }
Initializes all objects FullscreenVideoView depends on It does not interfere with configuration properties because it is supposed to be called when this Object still exists