Skip to content

Loop

The Loop engine shows other content in a continuous loop. This is a fundamental component that can be used to create more sophisticated channel content by nesting loops, using references and shuffling.

loop:
- image: picture.png
duration: 3
- video: video.mp4
- color: red
duration: 2
loop:
shuffle: cycle
content:
- image: picture.png
duration: 3
- video: video.mp4
- color: red
duration: 2

content shorthand required

Section titled “content ”

Type: content engine[]

Description: List of content to loop. Can be any content that TVS can display. When using the shorthand syntax, the list of content is specified directly under the loop key without the content property.

duration sub-property

Section titled “duration ”

Type: number

Description: Content inside a loop has a special optional property called duration, which specifies how long (in seconds) to display that content before moving to the next item in the loop. If duration is not specified for an item, the default behavior is to display it for its full length (e.g., the full duration of a video).

Not all content has “end detection”; in general, video content does but images and other content does not. If you don’t specify a duration for content without end detection, the duration defaults to 30 seconds.


Type: random | cycle | false

Added in version: 5.0.0

Whether to shuffle the content in the loop. If set to random, the content will be displayed in a random order. If set to cycle, the content will be displayed in a random order but will ensure that all items are shown once before any item is repeated. If set to false, the content will be displayed in the order it is defined.


Type: number, 1 or greater

Added in version: 5.5.0

Limits the number of items from the content list to include in the loop.

By default we don’t apply a limit. If set to a number less than the total number of items, only that many items will be randomly selected from the content list to be included in the loop.

This is useful when combined with shuffle to create a pool of content to choose from; for example, using shuffle: random and limit: 1 will grab one random piece of content whenever the loop is displayed. Nest this loop inside another loop and now you’ve created, for instance, an ad pool that will display a random ad from the loop each time it’s shown. Say you make that a ref then you can reuse it whenever you’d like to show an ad!