Class MetadataSync<TMeta, Meta, O>Abstract

Combines a metadata extractor with a jitter buffer with a metadata extractor, and fetches appropriate metadata as frames are rendered in a <video> element.

Most use cases should be able to use this helper instead of the individual parts.

Type Parameters

  • TMeta

  • Meta = unknown

  • O = unknown

Hierarchy

Constructors

Properties

cleanup?: (() => void)

Type declaration

    • (): void
    • Returns void

metadata?: TMeta

user metadata for the last presented video frame

queue: default<Meta>
ready: Promise<void>

promise resolving when the metadata extractor is ready

Methods

  • called by requestVideoFrameCallback when the video element presents a new frame.

    the default implementation looks up the new metadata from the jitter buffer, transforms it with transformMetadata and updates metadata.

    this method can be overriden to gather stats.

    Parameters

    • _now: number
    • frameMetadata: VideoFrameCallbackMetadata

    Returns void

  • transform metadata after retrieval from the jitter buffer, if present for the current frame.

    this is a good place to do simple post-processing that would incur extra cost if done in the worker because of the extra serialization, such as accumulating prior metadata or deltas.

    Parameters

    • metadata: Meta
    • timestamp: number

    Returns TMeta

Generated using TypeDoc