# VKSession wx.createVKSession(VKConfig object)

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

with Promise style call: Not supported

Mini Program plugin: Not supported

create vision kit Session object.

# parameter

# VKConfig object

# Return value

# VKSession

vision kit Session object

# sample code


// create session object
const ssession = wx.createVKSession({
  track: {
    plane: {mode: 1},
  },
})

// Frame-by-frame analysis
const onFrame = timestamp => {
  // Developers can control the frame rate themselves
  const frame = session.getVKFrame(canvasWidth, canvasHeight)
    if (frame) {
      // Once analyzed, you can get the frame object.
      doRender(frame)
    }

  session.requestAnimationFrame(onFrame)
}
session.start(err => {
  if (!err) session.requestAnimationFrame(onFrame)
})

// Render function
const doRender = frame => {
  // ...
}