createPrefetchSchedule method
Creates a prefetch schedule for a playback configuration. A prefetch schedule allows you to tell MediaTailor to fetch and prepare certain ads before an ad break happens. For more information about ad prefetching, see Using ad prefetching in the MediaTailor User Guide.
Parameter name :
The name to assign to the schedule request.
Parameter playbackConfigurationName :
The name to assign to the playback configuration.
Parameter consumption :
The configuration settings for how and when MediaTailor consumes
prefetched ads from the ad decision server for single prefetch schedules.
Each consumption configuration contains an end time and an optional start
time that define the consumption window. Prefetch schedules
automatically expire no earlier than seven days after the end time.
Parameter recurringPrefetchConfiguration :
The configuration that defines how and when MediaTailor performs ad
prefetching in a live event.
Parameter retrieval :
The configuration settings for retrieval of prefetched ads from the ad
decision server. Only one set of prefetched ads will be retrieved and
subsequently consumed for each ad break.
Parameter scheduleType :
The frequency that MediaTailor creates prefetch schedules.
SINGLE indicates that this schedule applies to one ad break.
RECURRING indicates that MediaTailor automatically creates a
schedule for each ad avail in a live event.
For more information about the prefetch types and when you might use each, see Prefetching ads in Elemental MediaTailor.
Parameter streamId :
An optional stream identifier that MediaTailor uses to prefetch ads for
multiple streams that use the same playback configuration. If
StreamId is specified, MediaTailor returns all of the
prefetch schedules with an exact match on StreamId. If not
specified, MediaTailor returns all of the prefetch schedules for the
playback configuration, regardless of StreamId.
Parameter tags :
The tags to assign to the prefetch schedule. Tags are key-value pairs that
you can associate with Amazon resources to help with organization, access
control, and cost tracking. For more information, see Tagging
AWS Elemental MediaTailor Resources.
Implementation
Future<CreatePrefetchScheduleResponse> createPrefetchSchedule({
required String name,
required String playbackConfigurationName,
PrefetchConsumption? consumption,
RecurringPrefetchConfiguration? recurringPrefetchConfiguration,
PrefetchRetrieval? retrieval,
PrefetchScheduleType? scheduleType,
String? streamId,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
if (consumption != null) 'Consumption': consumption,
if (recurringPrefetchConfiguration != null)
'RecurringPrefetchConfiguration': recurringPrefetchConfiguration,
if (retrieval != null) 'Retrieval': retrieval,
if (scheduleType != null) 'ScheduleType': scheduleType.value,
if (streamId != null) 'StreamId': streamId,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/prefetchSchedule/${Uri.encodeComponent(playbackConfigurationName)}/${Uri.encodeComponent(name)}',
exceptionFnMap: _exceptionFns,
);
return CreatePrefetchScheduleResponse.fromJson(response);
}