Skip to content

Stream

Source: src/AWS/KinesisVideo/Stream.ts

An Amazon Kinesis Video Stream for ingesting, storing, and consuming live video.

Stream creation is asynchronous — the provider waits (bounded) for the stream to become ACTIVE before returning. deviceName and mediaType are updated in place; dataRetention converges via UpdateDataRetention; changing streamName or kmsKeyId replaces the stream.

Basic Video Stream

import * as AWS from "alchemy/AWS";
const stream = yield* AWS.KinesisVideo.Stream("Camera");

Stream with Retention and Media Type

const stream = yield* AWS.KinesisVideo.Stream("Camera", {
mediaType: "video/h264",
dataRetention: "24 hours",
tags: { Environment: "production" },
});

Bind data-plane read operations in the init phase and use them in runtime handlers. The bindings resolve the per-stream data endpoint (GetDataEndpoint) automatically.

HLS Playback URL

// init
const getHls = yield* AWS.KinesisVideo.GetHLSStreamingSessionURL(stream);
// runtime
const { HLSStreamingSessionURL } = yield* getHls({ PlaybackMode: "LIVE" });

Raw Media

// init
const getMedia = yield* AWS.KinesisVideo.GetMedia(stream);
// runtime
const media = yield* getMedia({
StartSelector: { StartSelectorType: "EARLIEST" },
});