code: @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
      @Override
      public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
          Log.d(TAG, "onSurfaceTextureAvailable - state: " + this.currentState);
  
          Surface surface = new Surface(surfaceTexture);
          if (this.mediaPlayer != null) {
              this.mediaPlayer.setSurface(surface);
  
              // If is not prepared yet - tryToPrepare()
              if (!this.surfaceIsReady) {
                  this.surfaceIsReady = true;
                  if (this.currentState == State.INITIALIZED ||
                          this.currentState == State.PREPARING)
                      tryToPrepare();
              }
          }
      }
docs: TextureView