@Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        // Post to make sure we occur in order with any onSurfaceTextureAvailable calls.
        mainHandler.post(
                () -> {
                    if (surface != null) {
                        if (player != null) {
                            player.setSurface(null);
                        }
                        releaseSurface(surfaceTexture, surface);
                        surfaceTexture = null;
                        surface = null;
                    }
                });
    }
@param processor            Processor that draws to the view.
@param requireSecureContext Whether a GL context supporting protected content should be
                            created, if supported by the device.
dkplayer-sample/src/main/java/xyz/doikki/dkplayer/widget/render/gl/GLSurfaceRenderView.java