# CameraFrameListener CameraContext.onCameraFrame(function callback)

Start from base library version 2.7.0. Please remaining backward compatible.

with Promise style call: Not supported

Mini Program plugin: Not supported

Obtain Camera Real-time frame data

# parameter

# function callback


# parameter

# Object res
attribute type Introductions
width number Width of image data rectangle
height number Height of image data rectangle
data ArrayBuffer Image pixel data, one-dimensional array, every four items representing a pixel rgba

# Return value

# CameraFrameListener

Note: To use the interface, you must also use the camera Specified in component properties frame-size。

# sample code

const context = wx.createCameraContext()
const listener = context.onCameraFrame((frame) => {
  console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height)