Viam SDK
    Preparing search index...

    Interface Video

    A service that enables video streaming and retrieval for a given time range.

    interface Video {
        doCommand: (
            command: Struct | Record<string, JsonValue>,
        ) => Promise<JsonValue>;
        getVideo: (
            startTimestamp?: Date,
            endTimestamp?: Date,
            videoCodec?: string,
            videoContainer?: string,
            extra?: Struct,
        ) => AsyncIterable<VideoChunk>;
        name: string;
        getStatus(): Promise<JsonValue>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    Methods

    Properties

    doCommand: (command: Struct | Record<string, JsonValue>) => Promise<JsonValue>

    Send/receive arbitrary commands to the resource.

    Type Declaration

    getVideo: (
        startTimestamp?: Date,
        endTimestamp?: Date,
        videoCodec?: string,
        videoContainer?: string,
        extra?: Struct,
    ) => AsyncIterable<VideoChunk>

    Retrieve video data for a given time range.

    Type Declaration

      • (
            startTimestamp?: Date,
            endTimestamp?: Date,
            videoCodec?: string,
            videoContainer?: string,
            extra?: Struct,
        ): AsyncIterable<VideoChunk>
      • Parameters

        • OptionalstartTimestamp: Date

          Start time for the video retrieval.

        • OptionalendTimestamp: Date

          End time for the video retrieval.

        • OptionalvideoCodec: string

          Codec for the video (e.g., "h264", "h265").

        • OptionalvideoContainer: string

          Container format (e.g., "mp4", "fmp4").

        • Optionalextra: Struct

          Additional arguments.

        Returns AsyncIterable<VideoChunk>

        An async iterable of video chunks.

    const video = new VIAM.VideoClient(machine, 'my_video');
    const videoStream = video.getVideo(
    new Date('2025-01-01T00:00:00Z'),
    new Date('2025-01-01T00:10:00Z'),
    'h264',
    'mp4',
    );

    for await (const chunk of videoStream) {
    console.log('Received video chunk:', chunk.videoData.length, 'bytes');
    }
    name: string

    The name of the resource.

    Methods