Skip to main content
Version: v2

Interval Rules

An interval rule places a break on a channel at a regular interval or on a recurring schedule, without anyone creating each break. Use it for channels without ad markers, or with too few: "a break every 10 minutes" across a VOD asset, or "every 15 minutes between 18:00 and 23:00 on weekdays" on a live channel.

Each rule plays a template at every one of its slots, the moments the rule places a break at. A channel can have several rules, and they combine with the channel's other breaks, scheduled through the API or detected from markers.

Regional domains

The examples below use the US region (https://us.ads.optiview.dolby.com). For the EU region, replace us. with eu. (https://eu.ads.optiview.dolby.com).

How interval rules work​

What a rule does depends on the channel's stream type and timebase:

ChannelSlotsBreaks are placed
VOD, mediatimeEvery interval seconds from the start of the asset.By a channel sync, across the whole asset.
VOD, wallclockFrom the rule's startDate: every interval seconds, or on a schedule.By a channel sync, at the slots that fall inside the asset.
Live, wallclockFrom the rule's startDate: every interval seconds, or on a schedule.Automatically, a few minutes before each slot, for as long as the rule runs.
Live or VOD, ptsNot supported.

Every break a rule places is a regular break of the channel. It carries the rule's intervalRuleId, so you can list the breaks of a rule with GET /channels/{channelId}/breaks?filter=intervalRuleId==<rule-id>.

Slots​

On a VOD mediatime channel​

A slot is every multiple of the interval from the start of the asset. With an interval of 600, the slots are at 600, 1200, 1800 seconds, and so on. There is never a slot at the start of the asset itself: use a pre-roll for that, see Event based triggers. A break is only placed when the content resumes before the asset ends.

On a wallclock channel​

A rule on a wallclock channel, live or VOD, has a startDate and an optional endDate. It places its slots in one of two ways:

  • Every interval. The first slot is at the startDate, then one every interval seconds. A rule from 20:00 every 600 seconds has slots at 20:00, 20:10, 20:20, and so on.
  • On a schedule. The slots are the moments a cron expression matches, read in a timezone, from the startDate on. The startDate itself is a slot when it matches the schedule; otherwise the first match after it is the first slot.

The endDate is exclusive: no slot starts at or after it. A rule from 20:00 to 21:00 every 10 minutes has its last slot at 20:50. Without an endDate, the rule runs until you disable or delete it.

Slots on a wallclock channel are at least 60 seconds apart. A shorter interval is rejected, and so is a schedule with two slots closer together than that.

On a VOD wallclock channel, the slots count from the rule's startDate on the asset's program date-time timeline, and only the slots inside the asset get a break: never one at its very start or end. See Asset duration and start.

Schedules​

A schedule has a cron expression and the timezone it is read in, a name such as Europe/Brussels. The expression has five fields (minute, hour, day of month, month, day of week), or six with seconds first. Some examples:

cronSlots
*/15 18-22 * * 1-5Every 15 minutes from 18:00 to 23:00 on weekdays.
0 * * * *Every hour, on the hour.
30 20 * * 6,0At 20:30 on Saturday and Sunday.

Slots keep their local time across daylight-saving changes. A time the clock skips moves an hour later, and a time the clock repeats gets one slot.

The break​

Each slot gets one break, described by the rule's break:

FieldDescription
templateIdThe template that plays. One break can play several ads through its template.
durationOptional. The duration of the break in seconds, in place of the template's. Required when the template has no duration. Without it, the template's duration applies, also after the template changes.
resumeOffsetOptional. Where the content resumes, in seconds from the start of the break, in place of the template's. 0 inserts the break without skipping content. Without it, the template's resume offset applies, and otherwise the break's duration.

A break takes room on the channel until the content resumes: on a VOD channel up to its resume point, on a live channel for its duration. When a break, plus the rule's minimum spacing, takes longer than the interval, the slots that fall inside it are left out. For example, a 65-second break every 60 seconds plays at every other slot.

Limits​

FieldChannelsDescription
minSpacingAllSeconds kept free between a break of the rule and every other break of the channel, before and after it. A slot that comes closer is left out. Between two rules, the larger spacing applies. Defaults to 0.
priorityAllThe order among the channel's interval rules: the lowest applies first, the oldest rule first on a tie. Negative values are allowed. Defaults to 0.
excludeStartVOD onlyNo break starts in the first N seconds of the asset. Defaults to 0.
excludeEndVOD onlyA break is only placed when the content resumes before the last N seconds of the asset. Defaults to 0.
maxBreaksVOD onlyThe maximum number of breaks the rule places in the asset: the first ones that fit, in asset order. Breaks left out do not count. Unlimited by default.

A rule on a live channel does not accept excludeStart, excludeEnd, or maxBreaks. On a VOD channel, all rules together place at most 200 breaks; once the channel reaches that, the later rules and slots get none.

How interval breaks combine with other breaks​

Interval rules fill around the channel's other breaks: breaks scheduled through the API and breaks detected from markers. An interval break never moves or replaces another break. A slot whose break would overlap another break, or come within the minSpacing of one, is left out. Event-triggered breaks, such as pre-rolls and post-rolls, have no position on the timeline, so interval breaks never conflict with them.

Rules apply in priority order, and each rule fills around the breaks of the rules before it. A slot an earlier rule left out stays free for the later ones.

On a VOD channel​

On a VOD channel, the interval rules are the last step of a channel sync, after break detection. When a sync that also applies the interval rules places new detected breaks where interval breaks were, those breaks take the position, and the rules place their breaks around them again. A sync that does not apply the interval rules leaves out a new detected break that overlaps an interval break.

Creating a break through the API that overlaps an interval break is rejected, like any overlap. To place a break of your own there, create it before the sync, or change the rule so it leaves that position free and sync the channel first.

A change you make to an interval break itself, for example with PATCH /channels/{channelId}/breaks/{breakId}, is undone by the next sync. Change the rule instead.

On a live channel​

On a live channel, the first break created wins. A slot is left out when another break, created earlier, is in the way. The other way around, a marker break that would overlap an interval break is skipped, like any overlapping break, and creating a break through the API that overlaps an interval break is rejected.

When changes take effect​

On a VOD channel​

A channel sync places the breaks of the rules, and brings them in line with the rules every time it runs. A change to a rule, or to its template, takes effect on the channel's next sync:

  • Dashboard. Click Apply rules on the Interval rules card.
  • API. Run POST /channels/{channelId}/sync. The sync applies the interval rules unless you set intervalRules to false. To apply only the interval rules, turn off the channel's profiles and break detection:
curl -X POST 'https://us.ads.optiview.dolby.com/api/v1/channels/<channel-id>/sync' \
-u "$ADS_API_KEY:$ADS_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'X-Org-ID: <org-id>' \
-d '{ "profiles": false, "breakDetection": false }'

The sync keeps the breaks that did not change, updates the ones that did, and removes the breaks of slots the rules no longer place, including all the breaks of a disabled or deleted rule. Viewers who start playback after the sync get the new breaks.

On a live channel​

Breaks are created a few minutes before their slot, by default between 1 and 6 minutes ahead. Creating, editing, or deleting a rule takes effect right away, from the next slot on:

  • Breaks that were already created stay when you edit, disable, end, or delete the rule. Delete them through the API or the Dashboard if you do not want them.
  • A slot that has already passed is never created: a rule whose startDate lies in the past starts at its next slot.
  • A template change reaches the breaks created after it.
  • When you delete an interval break whose slot is only a few minutes away, the rule can create it again.

Asset duration and start​

On a VOD channel, the rules need to know how long the asset is, and on a wallclock channel also where it starts. The channel has two fields for this:

FieldChannelsDescription
assetDurationMsVODThe duration of the asset, in milliseconds.
assetStartVOD, wallclockWhere the asset starts on its program date-time timeline, as an ISO 8601 datetime.

You can leave both to OptiView Ads: every channel sync measures them on the channel's origins, and the channel uses the values of its highest-priority enabled origin that has them. For HLS, the duration is the sum of the segment durations and the start is the first segment's EXT-X-PROGRAM-DATE-TIME. For DASH, the duration is the mediaPresentationDuration and the start is the availabilityStartTime plus the start of the first Period.

To use your own values, set them on the channel with PATCH /channels/{channelId}, or in the Dashboard with Edit duration on the asset's Asset card. A value you set always wins over the measured one; set it to null to go back to the measured value. The channel returns the value in effect.

Without a known duration (and, on a wallclock channel, start), the rules place no breaks, and a sync removes the breaks they placed before.

Why a break is missing​

What you seeWhy
A VOD rule places no breaks at all.The channel has not been synced since the rule was created, or its asset duration (or start, on wallclock) is unknown. See Asset duration and start.
A rule places no breaks at all.The rule is disabled, its template was deleted, or neither the rule nor its template has a duration. On a VOD channel, the template cannot play on VOD, such as a Google Ad Manager pod template.
Every other slot is left out.The break, plus the minSpacing, takes longer than the interval. Shorten the break or the resume offset, or make the interval longer.
A slot near another break is left out.Another break of the channel overlaps it, or comes within the minSpacing: a break scheduled through the API, a detected break, or a break of a rule with a lower priority value.
No break at the start or end of a VOD asset.There is never a slot at the very start of the asset, and the content must resume after a break before the asset ends. excludeStart and excludeEnd keep more of the asset free.
A VOD rule stops after a number of breaks.The rule reached its maxBreaks, or the channel reached its maximum of 200 interval breaks.
A live rule creates no break for a slot.The slot had already passed when the rule was created or enabled, the slot is at or after the endDate, or another break was there first.
A live break still plays after the rule was changed or disabled.Breaks a live rule already created stay. The change applies from the next slot.
ResourceDescription
Place breaks at an intervalSet up an interval rule on a live and a VOD channel, step by step.
BreaksWhat a break contains, and how breaks are scheduled.
TemplatesThe templates interval rules play.
Break DetectionTurn the ad markers in your stream into breaks.