Skip to main content

onVideoSizeChange()

onVideoSizeChange: ({ GLctx, computeCtx, videoWidth, videoHeight, canvasWidth, canvasHeight, orientation })

Description

onVideoSizeChange() is called when the canvas changes size. Called with dimensions of video and canvas as well as device orientation.

Parameters

ParametersDescription
GLctxThe drawing canvas's WebGLRenderingContext or WebGL2RenderingContext.
computeCtxThe compute canvas's WebGLRenderingContext or WebGL2RenderingContext.
videoWidthThe width of the camera feed, in pixels.
videoHeightThe height of the camera feed, in pixels.
canvasWidthThe width of the GLctx canvas, in pixels.
canvasHeightThe height of the GLctx canvas, in pixels.
orientationThe rotation of the UI from portrait, in degrees (-90, 0, 90, 180).

Example

XR8.addCameraPipelineModule({
name: 'mycamerapipelinemodule',
onVideoSizeChange: ({ GLctx, videoWidth, videoHeight, canvasWidth, canvasHeight }) => {
myHandleResize({ GLctx, videoWidth, videoHeight, canvasWidth, canvasHeight })
},
})