AWS.KinesisVideo reference
GetClip
Section titled “GetClip”Source:
src/AWS/KinesisVideo/GetClip.ts
Runtime binding for kinesisvideo:GetClip (archived media data plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and downloads an MP4 clip covering the requested fragment range. The
response Payload is a streaming body.
GetClip: Reading Media
Section titled “GetClip: Reading Media”// initconst getClip = yield* AWS.KinesisVideo.GetClip(stream);
// runtimeconst clip = yield* getClip({ ClipFragmentSelector: { FragmentSelectorType: "SERVER_TIMESTAMP", TimestampRange: { StartTimestamp: start, EndTimestamp: end }, },});GetDASHStreamingSessionURL
Section titled “GetDASHStreamingSessionURL”Source:
src/AWS/KinesisVideo/GetDASHStreamingSessionURL.ts
Runtime binding for kinesisvideo:GetDASHStreamingSessionURL (archived
media data plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and returns a short-lived MPEG-DASH playback URL.
GetDASHStreamingSessionURL: Reading Media
Section titled “GetDASHStreamingSessionURL: Reading Media”// initconst getDash = yield* AWS.KinesisVideo.GetDASHStreamingSessionURL(stream);
// runtimeconst { DASHStreamingSessionURL } = yield* getDash({ PlaybackMode: "LIVE",});GetHLSStreamingSessionURL
Section titled “GetHLSStreamingSessionURL”Source:
src/AWS/KinesisVideo/GetHLSStreamingSessionURL.ts
Runtime binding for kinesisvideo:GetHLSStreamingSessionURL (archived
media data plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and returns a short-lived HLS playback URL.
GetHLSStreamingSessionURL: Reading Media
Section titled “GetHLSStreamingSessionURL: Reading Media”Live HLS Playback URL
// initconst getHls = yield* AWS.KinesisVideo.GetHLSStreamingSessionURL(stream);
// runtimeconst { HLSStreamingSessionURL } = yield* getHls({ PlaybackMode: "LIVE",});Wire into a Lambda Function
// Provide the GetHLSStreamingSessionURLHttp layer on the Function's// init Effect. Data-plane calls fan out to GetDataEndpoint first, so// allow a generous timeout.export default PlaybackFunction.make( { main: import.meta.url, functionUrl: true, timeout: Duration.seconds(30) }, Effect.gen(function* () { const stream = yield* AWS.KinesisVideo.Stream("Camera", { mediaType: "video/h264", dataRetention: "24 hours", }); const getHls = yield* AWS.KinesisVideo.GetHLSStreamingSessionURL(stream); return { fetch: Effect.gen(function* () { const { HLSStreamingSessionURL } = yield* getHls({ PlaybackMode: "LIVE", }); return HttpServerResponse.json({ url: HLSStreamingSessionURL }); }), }; }).pipe(Effect.provide(AWS.KinesisVideo.GetHLSStreamingSessionURLHttp)),);GetIceServerConfig
Section titled “GetIceServerConfig”Source:
src/AWS/KinesisVideo/GetIceServerConfig.ts
Runtime binding for kinesisvideo:GetIceServerConfig (WebRTC signaling
data plane).
Bind this operation to a SignalingChannel inside a function runtime to
get a callable that resolves the per-channel HTTPS signaling endpoint
(GetSignalingChannelEndpoint) and returns TURN server URIs with
short-lived credentials for establishing WebRTC connectivity.
GetIceServerConfig: WebRTC Connectivity
Section titled “GetIceServerConfig: WebRTC Connectivity”ICE Server Configuration
// initconst getIceServers = yield* AWS.KinesisVideo.GetIceServerConfig(channel);
// runtimeconst { IceServerList } = yield* getIceServers({ ClientId: "viewer-1" });Wire into a Lambda Function
// Provide the GetIceServerConfigHttp layer on the Function's init Effect.export default SignalingFunction.make( { main: import.meta.url, functionUrl: true, timeout: Duration.seconds(30) }, Effect.gen(function* () { const channel = yield* AWS.KinesisVideo.SignalingChannel("Doorbell"); const getIceServers = yield* AWS.KinesisVideo.GetIceServerConfig(channel); return { fetch: Effect.gen(function* () { const { IceServerList } = yield* getIceServers({ ClientId: "viewer-1", }); return HttpServerResponse.json({ iceServers: IceServerList }); }), }; }).pipe(Effect.provide(AWS.KinesisVideo.GetIceServerConfigHttp)),);GetImages
Section titled “GetImages”Source:
src/AWS/KinesisVideo/GetImages.ts
Runtime binding for kinesisvideo:GetImages (archived media data plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and extracts base64-encoded still images (JPEG/PNG) from the stored
media at the requested sampling interval.
GetImages: Reading Media
Section titled “GetImages: Reading Media”// initconst getImages = yield* AWS.KinesisVideo.GetImages(stream);
// runtimeconst { Images } = yield* getImages({ ImageSelectorType: "SERVER_TIMESTAMP", StartTimestamp: start, EndTimestamp: end, Format: "JPEG",});GetMedia
Section titled “GetMedia”Source:
src/AWS/KinesisVideo/GetMedia.ts
Runtime binding for kinesisvideo:GetMedia (media data plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and opens a media stream starting at the requested selector. The
response Payload is a streaming body of MKV-packaged media.
GetMedia: Reading Media
Section titled “GetMedia: Reading Media”Read Media from the Earliest Fragment
// initconst getMedia = yield* AWS.KinesisVideo.GetMedia(stream);
// runtimeconst media = yield* getMedia({ StartSelector: { StartSelectorType: "EARLIEST" },});Wire into a Lambda Function
// Provide the GetMediaHttp layer on the Function's init Effect; merge// with the other KinesisVideo layers when using several bindings.export default MediaFunction.make( { main: import.meta.url, functionUrl: true, timeout: Duration.seconds(30) }, Effect.gen(function* () { const stream = yield* AWS.KinesisVideo.Stream("Camera", { mediaType: "video/h264", dataRetention: "24 hours", }); const getMedia = yield* AWS.KinesisVideo.GetMedia(stream); // ... read media.Payload in the fetch handler return { fetch: handler }; }).pipe(Effect.provide(AWS.KinesisVideo.GetMediaHttp)),);GetMediaForFragmentList
Section titled “GetMediaForFragmentList”Source:
src/AWS/KinesisVideo/GetMediaForFragmentList.ts
Runtime binding for kinesisvideo:GetMediaForFragmentList (archived
media data plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and downloads MKV-packaged media for an explicit list of fragment
numbers (typically discovered via ListFragments). The response
Payload is a streaming body.
GetMediaForFragmentList: Reading Media
Section titled “GetMediaForFragmentList: Reading Media”// initconst getFragmentMedia = yield* AWS.KinesisVideo.GetMediaForFragmentList(stream);
// runtimeconst media = yield* getFragmentMedia({ Fragments: fragments.map((f) => f.FragmentNumber!),});JoinStorageSession
Section titled “JoinStorageSession”Source:
src/AWS/KinesisVideo/JoinStorageSession.ts
Runtime binding for kinesisvideo:JoinStorageSession (WebRTC storage
data plane).
Bind this operation to a SignalingChannel inside a function runtime to
get a callable that resolves the per-channel WEBRTC storage endpoint
(GetSignalingChannelEndpoint) and joins the ongoing WebRTC session as
the video-producing master so the media is recorded into the channel’s
associated Kinesis Video stream.
Requires the channel’s media storage to be configured (an ENABLED
MediaStorageConfiguration linking the channel to a stream); without it
the endpoint discovery fails with the typed SignalingEndpointUnavailable
error.
JoinStorageSession: WebRTC Storage
Section titled “JoinStorageSession: WebRTC Storage”// initconst joinStorage = yield* AWS.KinesisVideo.JoinStorageSession(channel);
// runtimeyield* joinStorage();JoinStorageSessionAsViewer
Section titled “JoinStorageSessionAsViewer”Source:
src/AWS/KinesisVideo/JoinStorageSessionAsViewer.ts
Runtime binding for kinesisvideo:JoinStorageSessionAsViewer (WebRTC
storage data plane).
Bind this operation to a SignalingChannel inside a function runtime to
get a callable that resolves the per-channel WEBRTC storage endpoint
(GetSignalingChannelEndpoint) and joins the ongoing WebRTC session as
a viewer, identified by clientId.
Requires the channel’s media storage to be configured (an ENABLED
MediaStorageConfiguration linking the channel to a stream); without it
the endpoint discovery fails with the typed SignalingEndpointUnavailable
error.
JoinStorageSessionAsViewer: WebRTC Storage
Section titled “JoinStorageSessionAsViewer: WebRTC Storage”// initconst joinAsViewer = yield* AWS.KinesisVideo.JoinStorageSessionAsViewer(channel);
// runtimeyield* joinAsViewer({ clientId: "viewer-1" });ListFragments
Section titled “ListFragments”Source:
src/AWS/KinesisVideo/ListFragments.ts
Runtime binding for kinesisvideo:ListFragments (archived media data
plane).
Bind this operation to a Stream inside a function runtime to get a
callable that resolves the per-stream data endpoint (GetDataEndpoint)
and lists the media fragments stored in the requested timestamp range.
ListFragments: Reading Media
Section titled “ListFragments: Reading Media”// initconst listFragments = yield* AWS.KinesisVideo.ListFragments(stream);
// runtimeconst { Fragments } = yield* listFragments({ FragmentSelector: { FragmentSelectorType: "SERVER_TIMESTAMP", TimestampRange: { StartTimestamp: start, EndTimestamp: end }, },});SendAlexaOfferToMaster
Section titled “SendAlexaOfferToMaster”Source:
src/AWS/KinesisVideo/SendAlexaOfferToMaster.ts
Runtime binding for kinesisvideo:SendAlexaOfferToMaster (WebRTC
signaling data plane).
Bind this operation to a SignalingChannel inside a function runtime to
get a callable that resolves the per-channel HTTPS signaling endpoint
(GetSignalingChannelEndpoint) and delivers a base64-encoded SDP offer
from an Alexa display device to the connected master peer, returning the
master’s SDP answer.
If no master is connected the service holds the offer for redelivery until the message TTL expires — bound the call with a timeout when the master may be offline.
SendAlexaOfferToMaster: WebRTC Connectivity
Section titled “SendAlexaOfferToMaster: WebRTC Connectivity”// initconst sendOffer = yield* AWS.KinesisVideo.SendAlexaOfferToMaster(channel);
// runtimeconst { Answer } = yield* sendOffer({ SenderClientId: "alexa-device-1", MessagePayload: base64SdpOffer,});SignalingChannel
Section titled “SignalingChannel”Source:
src/AWS/KinesisVideo/SignalingChannel.ts
An Amazon Kinesis Video Streams WebRTC signaling channel — the rendezvous point that WebRTC master and viewer peers use to exchange SDP offers, answers, and ICE candidates.
messageTtl is updated in place; changing channelName or type
replaces the channel.
SignalingChannel: Creating Channels
Section titled “SignalingChannel: Creating Channels”Basic Signaling Channel
import * as AWS from "alchemy/AWS";
const channel = yield* AWS.KinesisVideo.SignalingChannel("Doorbell");Channel with Message TTL
const channel = yield* AWS.KinesisVideo.SignalingChannel("Doorbell", { messageTtl: "30 seconds", tags: { Environment: "production" },});SignalingChannel: WebRTC Connectivity
Section titled “SignalingChannel: WebRTC Connectivity”// initconst getIceServers = yield* AWS.KinesisVideo.GetIceServerConfig(channel);
// runtime — TURN URIs + short-lived credentials for a WebRTC peerconst { IceServerList } = yield* getIceServers({ ClientId: "viewer-1" });Stream
Section titled “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.
Stream: Creating Streams
Section titled “Stream: Creating Streams”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" },});Stream: Reading Media
Section titled “Stream: Reading Media”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
// initconst getHls = yield* AWS.KinesisVideo.GetHLSStreamingSessionURL(stream);
// runtimeconst { HLSStreamingSessionURL } = yield* getHls({ PlaybackMode: "LIVE" });Raw Media
// initconst getMedia = yield* AWS.KinesisVideo.GetMedia(stream);
// runtimeconst media = yield* getMedia({ StartSelector: { StartSelectorType: "EARLIEST" },});