Class FrameProcessor

Frame Processor Simplifies grabbing frames from a camera or video file.

First, create:

import { FrameProcessor } from 'https://unpkg.com/ixfx/dist/io.js'
const fp = new FrameProcessor();

Then either use the camera or a video file:

fp.useCamera(constraints);
// or:
gp.useVideo(file);

With useCamera, optionally specify Io.Camera.Constraints to pick which camera and resolution.

fp.getFrame(); // Gets the last frame
fp.dispose(); // Close down camera/file

See FrameProcessorOpts for details on available options.

Constructors

Methods

  • Closes down connections and removes created elements. Once disposed, the frame processor cannot be used

    Returns void

  • Get the last frame

    Returns undefined | ImageData

  • Get the timestamp of the processor (elapsed time since starting)

    Returns number

  • Shows or hides the Canvas we're capturing to

    Parameters

    • enabled: boolean

    Returns void

  • Hides or shows the raw source in the DOM

    Parameters

    • enabled: boolean

      Preview enabled

    Returns void

  • Grab frames from a video camera source and initialises frame processor.

    If constraints are not specified, it will use the ones provided when creating the class, or defaults.

    Parameters

    • Optionalconstraints: Constraints

      Override of constraints when requesting camera access

    Returns Promise<void>

  • Parameters

    • file: File

    Returns Promise<void>