Measurement

Properties

on: {
    afterRESTCall:
        | null
        | (
            timestamp: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`,
            actionId: number,
            status: string,
            error: unknown,
        ) => void;
    beforeRESTCall:
        | null
        | (
            timestamp: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`,
            actionId: number,
        ) => void;
    bytesDownloaded:
        | null
        | (
            bytes: number,
            uncompressedSize: number,
            url: string,
            done: boolean,
        ) => void;
    chunkSent: null | (chunkSent: ChunkSent) => void;
    constraintsUpdated:
        | null
        | (feedback: ConstraintFeedback, status: ConstraintStatus) => void;
    error: null | (category: ErrorCategories, data: unknown) => void;
    faceTrackerStateChanged: null | (state: FaceTrackerState) => void;
    facialLandmarksUpdated: null | (drawables: Drawables) => void;
    mediaElementResize: null | (event: MediaElementResizeEvent) => void;
    resultsReceived: null | (results: Results) => void;
} = ...

Type declaration

  • afterRESTCall:
        | null
        | (
            timestamp: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`,
            actionId: number,
            status: string,
            error: unknown,
        ) => void

    after REST call

    timestamp of the event

    HTTP status code

    error object

  • beforeRESTCall:
        | null
        | (
            timestamp: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`,
            actionId: number,
        ) => void

    before REST call

    timestamp of the event

  • bytesDownloaded:
        | null
        | (
            bytes: number,
            uncompressedSize: number,
            url: string,
            done: boolean,
        ) => void

    bytes downloaded

    number of bytes downloaded

    uncompressed size of the file

    download URL

    true if download is complete

    Note: If server-side compression is enabled, then you're comparing the downloaded byte count (from the network stream) to the uncompressed file size which is not reliable.

  • chunkSent: null | (chunkSent: ChunkSent) => void

    When a chunk is sent to DeepAffex

  • constraintsUpdated: null | (feedback: ConstraintFeedback, status: ConstraintStatus) => void

    when measurement results are received

    measurement results

  • error: null | (category: ErrorCategories, data: unknown) => void

    When an error occurs

    error category

    error data

  • faceTrackerStateChanged: null | (state: FaceTrackerState) => void

    when face tracker state Changes

    face tracker state

  • facialLandmarksUpdated: null | (drawables: Drawables) => void

    When facial landmarks are updated

  • mediaElementResize: null | (event: MediaElementResizeEvent) => void

    When media element size changes

  • resultsReceived: null | (results: Results) => void

    when measurement results are received

    measurement results

VERSION: string = version

Methods

  • Returns Promise<void>

  • Disconnect from the Web Socket if the measurement is started

    Returns Promise<void>

  • Check if SIMD is supported and then download the supported MediaPipe face traker assets for the runtime environment It also downloads the extraction lib assets

    Returns Promise<undefined | boolean>

    true if successfully download all files

  • Returns version number

    Returns SDKVersion

    version - [Web SDK, DFX Extraction Lib, Face Tracker]

  • Parameters

    • element: SVGSVGElement

    Returns void

  • Parameters

    • token: string
    • refreshToken: string
    • studyId: string
    • OptionalsdkId: string

    Returns Promise<boolean>

  • Reset only if the face tracker is ready and tracking

    Returns Promise<boolean>

    true if the reset was successful, false otherwise

  • Parameters

    • override: boolean

    Returns Promise<void>

  • Set demographics

    Parameters

    Returns boolean

    true if demographics are valid and set, false otherwise

  • Set extraction library settings

    Parameters

    • numberofChunks: number = 6

      Number of chunks for extraction library collector

    • targetFPS: number = 30

      Target FPS for extraction library collector

    • chunkDurationSeconds: number = 5

      Chunk duration in seconds for extraction library collector

    Returns void

  • Parameters

    • mediaStream: MediaStream

    Returns Promise<void>

  • Set the action for the next chunk to LAST::PROCESS

    Returns Promise<void>

  • Set settings

    Parameters

    Returns boolean

    true if success

  • Start measurement by obtaining a measurement ID, resetting the collection, setting number of chunks and constraints config, setting demographics, starting collection, and connecting to the Web Socket if user token is available.

    Returns the measurement ID.

    Parameters

    Returns Promise<string>

  • Returns Promise<void>

  • Stop Face Tracker tracking frames and DFX extraction library collection If the measurement is started, it will disconnect from the Web Socket as well.

    Returns Promise<void>