| 1 | import type * as kv from "@distilled.cloud/aws/kinesis-video"; |
| 2 | import type * as kvam from "@distilled.cloud/aws/kinesis-video-archived-media"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import * as Binding from "../../Binding.ts"; |
| 5 | import type { Stream } from "./Stream.ts"; |
| 6 | |
| 7 | export interface GetClipRequest extends Omit< |
| 8 | kvam.GetClipInput, |
| 9 | "StreamName" | "StreamARN" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `kinesisvideo:GetClip` (archived media data plane). |
| 14 | * |
| 15 | * Bind this operation to a `Stream` inside a function runtime to get a |
| 16 | * callable that resolves the per-stream data endpoint (`GetDataEndpoint`) |
| 17 | * and downloads an MP4 clip covering the requested fragment range. The |
| 18 | * response `Payload` is a streaming body. |
| 19 | * ### Reading Media |
| 20 | * **Example:** Download a Clip |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const getClip = yield* AWS.KinesisVideo.GetClip(stream); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const clip = yield* getClip({ |
| 27 | * ClipFragmentSelector: { |
| 28 | * FragmentSelectorType: "SERVER_TIMESTAMP", |
| 29 | * TimestampRange: { StartTimestamp: start, EndTimestamp: end }, |
| 30 | * }, |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetClip extends Binding.Service< |
| 37 | GetClip, |
| 38 | "AWS.KinesisVideo.GetClip", |
| 39 | <S extends Stream>( |
| 40 | stream: S, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: GetClipRequest, |
| 44 | ) => Effect.Effect< |
| 45 | kvam.GetClipOutput, |
| 46 | kvam.GetClipError | kv.GetDataEndpointError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | |
| 51 | export const GetClip = Binding.Service<GetClip>("AWS.KinesisVideo.GetClip"); |