Skip to main content


onAttach: ({framework, canvas, GLctx, computeCtx, isWebgl2, orientation, videoWidth, videoHeight, canvasWidth, canvasHeight, status, stream, video, version, imageTargets, config})


onAttach() is called before the first time a module receives frame updates. It is called on modules that were added either before or after the pipeline is running. It includes all the most recent data available from:


frameworkThe framework bindings for this module for dispatching events.
canvasThe canvas that backs GPU processing and user display.
GLctxThe drawing canvas's WebGLRenderingContext or WebGL2RenderingContext.
computeCtxThe compute canvas's WebGLRenderingContext or WebGL2RenderingContext.
isWebgl2True if GLctx is a WebGL2RenderingContext.
orientationThe rotation of the UI from portrait, in degrees (-90, 0, 90, 180).
videoWidthThe height 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.
statusOne of [ 'requesting', 'hasStream', 'hasVideo', 'failed' ]
streamThe MediaStream associated with the camera feed.
videoThe video dom element displaying the stream.
version [Optional]The engine version, e.g., if app resources are loaded.
imageTargets [Optional]An array of image targets with the fields {imagePath, metadata, name}
configThe configuration parameters that were passed to