AWS.MediaPackageV2 reference
CancelHarvestJob
Section titled “CancelHarvestJob”Source:
src/AWS/MediaPackageV2/CancelHarvestJob.ts
Runtime binding for mediapackagev2:CancelHarvestJob.
Cancels a queued or in-progress harvest job on the bound
OriginEndpoint — e.g. aborting a clip export the operator
withdrew. The endpoint’s group, channel, and name are injected from the
binding. Provide the implementation with
Effect.provide(AWS.MediaPackageV2.CancelHarvestJobHttp).
CancelHarvestJob: Harvesting Live-to-VOD Clips
Section titled “CancelHarvestJob: Harvesting Live-to-VOD Clips”// init — bind the operation to the endpointconst cancelHarvestJob = yield* AWS.MediaPackageV2.CancelHarvestJob(endpoint);
// runtimeyield* cancelHarvestJob({ HarvestJobName: job.HarvestJobName });Channel
Section titled “Channel”Source:
src/AWS/MediaPackageV2/Channel.ts
An AWS Elemental MediaPackage v2 channel — the entry point for live content into MediaPackage. An encoder (such as AWS Elemental MediaLive) pushes an HLS or CMAF stream to the channel’s ingest endpoints; origin endpoints then package and serve that content downstream.
Channel: Creating a Channel
Section titled “Channel: Creating a Channel”Basic Channel in a Group
import * as MediaPackageV2 from "alchemy/AWS/MediaPackageV2";
const group = yield* MediaPackageV2.ChannelGroup("Live");const channel = yield* MediaPackageV2.Channel("Feed", { channelGroupName: group.channelGroupName,});CMAF Ingest Channel
const channel = yield* MediaPackageV2.Channel("Feed", { channelGroupName: group.channelGroupName, inputType: "CMAF", description: "CMAF contribution feed",});Channel: Resource Policy
Section titled “Channel: Resource Policy”const channel = yield* MediaPackageV2.Channel("Feed", { channelGroupName: group.channelGroupName, policy: JSON.stringify({ Version: "2012-10-17", Statement: [{ Effect: "Allow", Principal: { AWS: "arn:aws:iam::111122223333:root" }, Action: "mediapackagev2:PutObject", Resource: "arn:aws:mediapackagev2:us-east-1:111122223333:channelGroup/live/channel/feed", }], }),});Channel: Ingest Endpoints
Section titled “Channel: Ingest Endpoints”const channel = yield* MediaPackageV2.Channel("Feed", { channelGroupName: group.channelGroupName,});// Two redundant ingest endpoints for the encoder to push to.const urls = channel.ingestEndpoints;ChannelGroup
Section titled “ChannelGroup”Source:
src/AWS/MediaPackageV2/ChannelGroup.ts
An AWS Elemental MediaPackage v2 channel group — the top-level container for channels and origin endpoints. All channels and origin endpoints in a group share one egress domain, giving downstream players and CDNs predictable URLs for stream delivery.
ChannelGroup: Creating a Channel Group
Section titled “ChannelGroup: Creating a Channel Group”Basic Channel Group
import * as MediaPackageV2 from "alchemy/AWS/MediaPackageV2";
const group = yield* MediaPackageV2.ChannelGroup("Live");Channel Group with Description and Tags
const group = yield* MediaPackageV2.ChannelGroup("Live", { description: "Live sports streams", tags: { team: "media" },});ChannelGroup: Egress Domain
Section titled “ChannelGroup: Egress Domain”const group = yield* MediaPackageV2.ChannelGroup("Live");// e.g. abcde.egress.xyz.mediapackagev2.us-east-1.amazonaws.comconst domain = group.egressDomain;CreateHarvestJob
Section titled “CreateHarvestJob”Source:
src/AWS/MediaPackageV2/CreateHarvestJob.ts
Runtime binding for mediapackagev2:CreateHarvestJob.
Exports a clip of previously streamed content from the bound
OriginEndpoint to an S3 bucket as a live-to-VOD asset — e.g. a
Lambda that clips a highlight when an operator flags a moment. The
endpoint must have a startover window covering the requested schedule,
and the destination bucket needs a policy granting the
mediapackagev2.amazonaws.com service principal write access. The
endpoint’s group, channel, and name are injected from the binding.
Provide the implementation with
Effect.provide(AWS.MediaPackageV2.CreateHarvestJobHttp).
CreateHarvestJob: Harvesting Live-to-VOD Clips
Section titled “CreateHarvestJob: Harvesting Live-to-VOD Clips”// init — bind the operation to the endpointconst createHarvestJob = yield* AWS.MediaPackageV2.CreateHarvestJob(endpoint);
// runtimeconst job = yield* createHarvestJob({ HarvestedManifests: { HlsManifests: [{ ManifestName: "index" }] }, ScheduleConfiguration: { StartTime: new Date(Date.now() - 5 * 60_000), EndTime: new Date(), }, Destination: { S3Destination: { BucketName: "my-clips", DestinationPath: "highlights/" }, },});GetHarvestJob
Section titled “GetHarvestJob”Source:
src/AWS/MediaPackageV2/GetHarvestJob.ts
Runtime binding for mediapackagev2:GetHarvestJob.
Reads the status of a harvest job on the bound OriginEndpoint —
e.g. polling until a clip export reaches COMPLETED before publishing
the VOD asset. The endpoint’s group, channel, and name are injected from
the binding. Provide the implementation with
Effect.provide(AWS.MediaPackageV2.GetHarvestJobHttp).
GetHarvestJob: Harvesting Live-to-VOD Clips
Section titled “GetHarvestJob: Harvesting Live-to-VOD Clips”// init — bind the operation to the endpointconst getHarvestJob = yield* AWS.MediaPackageV2.GetHarvestJob(endpoint);
// runtimeconst { Status } = yield* getHarvestJob({ HarvestJobName: job.HarvestJobName });ListHarvestJobs
Section titled “ListHarvestJobs”Source:
src/AWS/MediaPackageV2/ListHarvestJobs.ts
Runtime binding for mediapackagev2:ListHarvestJobs.
Enumerates the harvest jobs in the bound ChannelGroup, optionally
filtered by channel, endpoint, or status — e.g. a dashboard Lambda
listing in-progress clip exports. The group’s name is injected from the
binding. Provide the implementation with
Effect.provide(AWS.MediaPackageV2.ListHarvestJobsHttp).
ListHarvestJobs: Harvesting Live-to-VOD Clips
Section titled “ListHarvestJobs: Harvesting Live-to-VOD Clips”// init — bind the operation to the channel groupconst listHarvestJobs = yield* AWS.MediaPackageV2.ListHarvestJobs(group);
// runtimeconst { Items } = yield* listHarvestJobs({ Status: "QUEUED" });OriginEndpoint
Section titled “OriginEndpoint”Source:
src/AWS/MediaPackageV2/OriginEndpoint.ts
An AWS Elemental MediaPackage v2 origin endpoint — the output side of a channel. The endpoint packages the channel’s ingested content into HLS, low-latency HLS, DASH, and/or MSS manifests and serves them to downstream devices (players or CDNs) on the channel group’s egress domain.
OriginEndpoint: Creating an Origin Endpoint
Section titled “OriginEndpoint: Creating an Origin Endpoint”HLS Endpoint on a Channel
import * as MediaPackageV2 from "alchemy/AWS/MediaPackageV2";
const group = yield* MediaPackageV2.ChannelGroup("Live");const channel = yield* MediaPackageV2.Channel("Feed", { channelGroupName: group.channelGroupName,});const endpoint = yield* MediaPackageV2.OriginEndpoint("Playback", { channelGroupName: group.channelGroupName, channelName: channel.channelName, containerType: "TS", hlsManifests: [{ ManifestName: "index" }],});CMAF Endpoint with DASH and Low-Latency HLS
const endpoint = yield* MediaPackageV2.OriginEndpoint("Playback", { channelGroupName: group.channelGroupName, channelName: channel.channelName, containerType: "CMAF", segment: { SegmentDurationSeconds: 4 }, dashManifests: [{ ManifestName: "dash" }], lowLatencyHlsManifests: [{ ManifestName: "ll-hls" }],});OriginEndpoint: Startover Window
Section titled “OriginEndpoint: Startover Window”const endpoint = yield* MediaPackageV2.OriginEndpoint("Playback", { channelGroupName: group.channelGroupName, channelName: channel.channelName, containerType: "TS", startoverWindow: "1 hour", hlsManifests: [{ ManifestName: "index" }],});OriginEndpoint: Resource Policy
Section titled “OriginEndpoint: Resource Policy”const endpoint = yield* MediaPackageV2.OriginEndpoint("Playback", { channelGroupName: group.channelGroupName, channelName: channel.channelName, containerType: "TS", hlsManifests: [{ ManifestName: "index" }], policy: JSON.stringify({ Version: "2012-10-17", Statement: [{ Effect: "Allow", Principal: { AWS: "arn:aws:iam::111122223333:root" }, Action: ["mediapackagev2:GetObject", "mediapackagev2:GetHeadObject"], Resource: "arn:aws:mediapackagev2:us-east-1:111122223333:channelGroup/live/channel/feed/originEndpoint/playback", }], }),});OriginEndpoint: Playback URLs
Section titled “OriginEndpoint: Playback URLs”const playbackUrl = endpoint.hlsManifests.map((m) => m.url);ResetChannelState
Section titled “ResetChannelState”Source:
src/AWS/MediaPackageV2/ResetChannelState.ts
Runtime binding for mediapackagev2:ResetChannelState.
Resets the ingest state of the bound Channel — clearing buffered
content so the encoder can re-push a clean stream after a corrupted
contribution (e.g. an ops Lambda recovering a broken live event). The
channel’s group and name are injected from the binding. Provide the
implementation with
Effect.provide(AWS.MediaPackageV2.ResetChannelStateHttp).
ResetChannelState: Resetting Ingest State
Section titled “ResetChannelState: Resetting Ingest State”// init — bind the operation to the channelconst resetChannel = yield* AWS.MediaPackageV2.ResetChannelState(channel);
// runtimeconst { ResetAt } = yield* resetChannel();ResetOriginEndpointState
Section titled “ResetOriginEndpointState”Source:
src/AWS/MediaPackageV2/ResetOriginEndpointState.ts
Runtime binding for mediapackagev2:ResetOriginEndpointState.
Resets the packaging state of the bound OriginEndpoint — clearing
its manifests and cached segments so playback restarts clean after the
channel’s content was reset or replaced. The endpoint’s group, channel,
and name are injected from the binding. Provide the implementation with
Effect.provide(AWS.MediaPackageV2.ResetOriginEndpointStateHttp).
ResetOriginEndpointState: Resetting Ingest State
Section titled “ResetOriginEndpointState: Resetting Ingest State”// init — bind the operation to the endpointconst resetEndpoint = yield* AWS.MediaPackageV2.ResetOriginEndpointState(endpoint);
// runtimeconst { ResetAt } = yield* resetEndpoint();