Skip to content

AWS.MediaPackageV2 reference

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 endpoint
const cancelHarvestJob = yield* AWS.MediaPackageV2.CancelHarvestJob(endpoint);
// runtime
yield* cancelHarvestJob({ HarvestJobName: job.HarvestJobName });

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.

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",
});
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",
}],
}),
});
const channel = yield* MediaPackageV2.Channel("Feed", {
channelGroupName: group.channelGroupName,
});
// Two redundant ingest endpoints for the encoder to push to.
const urls = channel.ingestEndpoints;

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.

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" },
});
const group = yield* MediaPackageV2.ChannelGroup("Live");
// e.g. abcde.egress.xyz.mediapackagev2.us-east-1.amazonaws.com
const domain = group.egressDomain;

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 endpoint
const createHarvestJob = yield* AWS.MediaPackageV2.CreateHarvestJob(endpoint);
// runtime
const 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/" },
},
});

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 endpoint
const getHarvestJob = yield* AWS.MediaPackageV2.GetHarvestJob(endpoint);
// runtime
const { Status } = yield* getHarvestJob({ HarvestJobName: job.HarvestJobName });

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 group
const listHarvestJobs = yield* AWS.MediaPackageV2.ListHarvestJobs(group);
// runtime
const { Items } = yield* listHarvestJobs({ Status: "QUEUED" });

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" }],
});
const endpoint = yield* MediaPackageV2.OriginEndpoint("Playback", {
channelGroupName: group.channelGroupName,
channelName: channel.channelName,
containerType: "TS",
startoverWindow: "1 hour",
hlsManifests: [{ ManifestName: "index" }],
});
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",
}],
}),
});
const playbackUrl = endpoint.hlsManifests.map((m) => m.url);

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).

// init — bind the operation to the channel
const resetChannel = yield* AWS.MediaPackageV2.ResetChannelState(channel);
// runtime
const { ResetAt } = yield* resetChannel();

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 endpoint
const resetEndpoint =
yield* AWS.MediaPackageV2.ResetOriginEndpointState(endpoint);
// runtime
const { ResetAt } = yield* resetEndpoint();