Skip to content

AWS.MediaTailor reference

Source: src/AWS/MediaTailor/CreatePrefetchSchedule.ts

Runtime binding for mediatailor:CreatePrefetchSchedule — tell MediaTailor to fetch and prepare ads for upcoming ad breaks ahead of time (e.g. right before a live event’s scheduled break) so avails fill without ADS latency.

The bound PlaybackConfiguration’s name is injected; the grant is scoped to that configuration’s prefetch-schedule ARN space. Provide the implementation with Effect.provide(AWS.MediaTailor.CreatePrefetchScheduleHttp).

const createPrefetchSchedule = yield* AWS.MediaTailor.CreatePrefetchSchedule(config);
const schedule = yield* createPrefetchSchedule({
Name: `event-${eventId}`,
Retrieval: { EndTime: retrievalDeadline },
Consumption: { EndTime: breakEnd },
});

Source: src/AWS/MediaTailor/CreateProgram.ts

Runtime binding for mediatailor:CreateProgram — schedule a VOD or live source as a program on a channel-assembly channel. Dynamic program scheduling is the core runtime workflow of channel assembly: applications insert programs into a linear channel’s schedule as content becomes available.

Channel/program names are runtime parameters, so the binding is account-level and grants mediatailor:CreateProgram on *. Provide the implementation with Effect.provide(AWS.MediaTailor.CreateProgramHttp).

const createProgram = yield* AWS.MediaTailor.CreateProgram();
yield* createProgram({
ChannelName: "my-channel",
ProgramName: `episode-${id}`,
SourceLocationName: "my-origin",
VodSourceName: "episode-1",
ScheduleConfiguration: { Transition: { Type: "RELATIVE", RelativePosition: "AFTER_PROGRAM" } },
});

Source: src/AWS/MediaTailor/DeletePrefetchSchedule.ts

Runtime binding for mediatailor:DeletePrefetchSchedule — remove a prefetch schedule from the bound PlaybackConfiguration (e.g. when a live event is cancelled).

Provide the implementation with Effect.provide(AWS.MediaTailor.DeletePrefetchScheduleHttp).

const deletePrefetchSchedule = yield* AWS.MediaTailor.DeletePrefetchSchedule(config);
yield* deletePrefetchSchedule({ Name: `event-${eventId}` });

Source: src/AWS/MediaTailor/DeleteProgram.ts

Runtime binding for mediatailor:DeleteProgram — remove a scheduled program from a channel-assembly channel.

Channel/program names are runtime parameters, so the binding is account-level and grants mediatailor:DeleteProgram on *. Provide the implementation with Effect.provide(AWS.MediaTailor.DeleteProgramHttp).

const deleteProgram = yield* AWS.MediaTailor.DeleteProgram();
yield* deleteProgram({
ChannelName: "my-channel",
ProgramName: `episode-${id}`,
});

Source: src/AWS/MediaTailor/DescribeProgram.ts

Runtime binding for mediatailor:DescribeProgram — read a scheduled program on a channel-assembly channel.

Channel/program names are runtime parameters, so the binding is account-level and grants mediatailor:DescribeProgram on *. Provide the implementation with Effect.provide(AWS.MediaTailor.DescribeProgramHttp).

const describeProgram = yield* AWS.MediaTailor.DescribeProgram();
const program = yield* describeProgram({
ChannelName: "my-channel",
ProgramName: `episode-${id}`,
});

Source: src/AWS/MediaTailor/GetChannelSchedule.ts

Runtime binding for mediatailor:GetChannelSchedule — read the current schedule (programs + ad breaks) of a channel-assembly channel.

Channel names are runtime parameters, so the binding is account-level and grants mediatailor:GetChannelSchedule on *. Provide the implementation with Effect.provide(AWS.MediaTailor.GetChannelScheduleHttp).

const getChannelSchedule = yield* AWS.MediaTailor.GetChannelSchedule();
const { Items } = yield* getChannelSchedule({ ChannelName: "my-channel" });

Source: src/AWS/MediaTailor/GetPrefetchSchedule.ts

Runtime binding for mediatailor:GetPrefetchSchedule — read a prefetch schedule on the bound PlaybackConfiguration by name.

Provide the implementation with Effect.provide(AWS.MediaTailor.GetPrefetchScheduleHttp).

const getPrefetchSchedule = yield* AWS.MediaTailor.GetPrefetchSchedule(config);
const schedule = yield* getPrefetchSchedule({ Name: `event-${eventId}` });

Source: src/AWS/MediaTailor/ListAlerts.ts

Runtime binding for mediatailor:ListAlerts — read the operational alerts MediaTailor raises for a channel-assembly resource (channel, source location, VOD/live source) identified by ARN.

Resource ARNs are runtime parameters, so the binding is account-level and grants mediatailor:ListAlerts on *. Provide the implementation with Effect.provide(AWS.MediaTailor.ListAlertsHttp).

const listAlerts = yield* AWS.MediaTailor.ListAlerts();
const { Items } = yield* listAlerts({ ResourceArn: channelArn });

Source: src/AWS/MediaTailor/ListPrefetchSchedules.ts

Runtime binding for mediatailor:ListPrefetchSchedules — page through the prefetch schedules on the bound PlaybackConfiguration, optionally filtered by StreamId or ScheduleType.

Provide the implementation with Effect.provide(AWS.MediaTailor.ListPrefetchSchedulesHttp).

const listPrefetchSchedules = yield* AWS.MediaTailor.ListPrefetchSchedules(config);
const { Items } = yield* listPrefetchSchedules({ StreamId: streamId });

Source: src/AWS/MediaTailor/PlaybackConfiguration.ts

An AWS Elemental MediaTailor playback configuration for server-side ad insertion (SSAI) into HLS and DASH video streams.

PlaybackConfiguration: Creating Playback Configurations

Section titled “PlaybackConfiguration: Creating Playback Configurations”

Basic ad-inserted stream

import * as MediaTailor from "alchemy/AWS/MediaTailor";
const config = yield* MediaTailor.PlaybackConfiguration("Ads", {
adDecisionServerUrl: "https://ads.example.com/vast?ip=[client_ip]",
videoContentSourceUrl: "https://origin.example.com/live",
});

Slate fill and personalization threshold

const config = yield* MediaTailor.PlaybackConfiguration("Ads", {
adDecisionServerUrl: "https://ads.example.com/vast",
videoContentSourceUrl: "https://origin.example.com/vod",
slateAdUrl: "https://origin.example.com/slate.mp4",
personalizationThreshold: "2 seconds",
});
const config = yield* MediaTailor.PlaybackConfiguration("Live", {
adDecisionServerUrl: "https://ads.example.com/vast",
videoContentSourceUrl: "https://origin.example.com/live",
manifestProcessingRules: { adMarkerPassthroughEnabled: true },
availSuppression: { mode: "BEHIND_LIVE_EDGE", value: "00:00:30" },
});
const config = yield* MediaTailor.PlaybackConfiguration("Logged", {
adDecisionServerUrl: "https://ads.example.com/vast",
videoContentSourceUrl: "https://origin.example.com/live",
logConfiguration: { percentEnabled: 10 },
});

Source: src/AWS/MediaTailor/StartChannel.ts

Runtime binding for mediatailor:StartChannel — start a channel-assembly channel so it begins producing its linear stream.

Channel names are runtime parameters, so the binding is account-level and grants mediatailor:StartChannel on *. Provide the implementation with Effect.provide(AWS.MediaTailor.StartChannelHttp).

const startChannel = yield* AWS.MediaTailor.StartChannel();
yield* startChannel({ ChannelName: "my-channel" });

Source: src/AWS/MediaTailor/StopChannel.ts

Runtime binding for mediatailor:StopChannel — stop a running channel-assembly channel.

Channel names are runtime parameters, so the binding is account-level and grants mediatailor:StopChannel on *. Provide the implementation with Effect.provide(AWS.MediaTailor.StopChannelHttp).

const stopChannel = yield* AWS.MediaTailor.StopChannel();
yield* stopChannel({ ChannelName: "my-channel" });

Source: src/AWS/MediaTailor/UpdateProgram.ts

Runtime binding for mediatailor:UpdateProgram — move or re-configure a scheduled program on a channel-assembly channel (e.g. change its transition or ad breaks) before it plays.

Channel/program names are runtime parameters, so the binding is account-level and grants mediatailor:UpdateProgram on *. Provide the implementation with Effect.provide(AWS.MediaTailor.UpdateProgramHttp).

const updateProgram = yield* AWS.MediaTailor.UpdateProgram();
yield* updateProgram({
ChannelName: "my-channel",
ProgramName: `episode-${id}`,
ScheduleConfiguration: { Transition: { ScheduledStartTimeMillis: startAt } },
});