Class CameraKitSource

This general-purpose class represents a source of media for a CameraKitSession.

When an instance is passed to CameraKitSession.setSource, it will be "attached" to the session. Later it may be "detached" from the session.

Passing a CameraKitSourceSubscriber to the constructor allows callers to specify behavior that will occur when the source is attached and detached. This can be used to e.g. update the render size.

Hierarchy

  • CameraKitSource

Constructors

Methods

  • Set the resolution used to render this source.

    It’s important to distinguish render size from display size. The size at which the output canvases are displayed on a web page is determined by the CSS of the page. It is distinct from the size at which LensCore renders Lenses. Performance is dominated by render size, while any display scaling can most often be thought of as free.

    If greater performance is required, a smaller render size may boost frame-rate. It does come at a cost, including loss of accuracy in various tracking and computer-vision algorithms (since they'll be operating on fewer pixels).

    The size of the Live and Capture RenderTarget is always the same.

    Parameters

    • width: number

      pixels

    • height: number

      pixels

    Returns Promise<void>

    Promise resolves when the render size has been successfully updated.

    Todo

    Currently it's only valid to call setRenderSize after CameraKitSession.play has been called. This constraint should be removed, so callers don't have to understand the underlying LensCore state machine.

  • Apply a 2D transformation to the source (e.g. translation, rotation, scale).

    Parameters

    • transform: Transform2D

      Specifies the 3x3 matrix describing the transformation.

    Returns Promise<void>

Generated using TypeDoc