public void setSurface(Surface surface) {
        mSurface = surface;
        if (mScreenOnWhilePlaying && surface != null) {
            Log.w(TAG, "setScreenOnWhilePlaying(true) is ineffective for Surface");
        }
        mSurfaceHolder = null;

        if(mPlaybackThread == null) {
            // Player not prepared yet, so we can set the timing mode
            setVideoRenderTimingMode(VideoRenderTimingMode.SLEEP); // the surface could be a GL texture, so we switch to sleep timing mode
            updateSurfaceScreenOn();
        } else {
            // Player is already prepared, just change the surface
            mPlaybackThread.setSurface(mSurface);
        }
    }
@see android.media.MediaPlayer#setSurface(android.view.Surface)
MediaPlayer/src/main/java/net/protyposis/android/mediaplayer/MediaPlayer.java