This document describes the public scripting API available to Template Builder and Viz Pilot Edge templates. Scripts are written in TypeScript and compiled to JavaScript for execution in the browser. This API exposes the following:

  • Global TypeScript types

  • The global vizrt object (template-level events & data access)

  • The global app object (application-level utilities)

  • Global helper functions

Pilot Data Types

PilotData

Contains Pilot- and MOS-related information available to scripts.

Property

Type

Description

mosartConfig?

MosartConfig

Read-only Viz Mosart configuration

mosartTimingPanel?

MosartTimingPanel

State and options for the Viz Mosart Timing Panel

mos

MOS

MOS data and related settings

element?

PilotElementInfo

Information about the current data element

PilotElementInfo

Property

Type

Description

elementId?

string

ID of the currently open element

Mosart & Timing Panel

MosartTimingPanel

Represents the state and customization options for the Viz Mosart Timing Panel.

Property

Type

Description

destinations

readonly string[]

Available playout destinations

showIsLocator

boolean

Whether to expose the IsLocator option

showContinueCount

boolean

Whether to expose the ContinueCount option

expanded

boolean

Whether the panel is expanded by default (default: true)

MosartConfig

Read-only Viz Mosart configuration.

Property

Type

Description

showTimingPanel

boolean

Whether the timing panel should be shown

destinations

readonly string[]

Default Viz Mosart destinations

showIsLocator

boolean

Whether IsLocator is shown by default

MOS Types

MEMBlock

A MOS External Metadata (MEM) block.

Property

Type

Description

schema

string

Schema URL for the block

payload

string

XML payload content

scope

"PLAYLIST" | "STORY" | "OBJECT"

The scope of the MEM block

MEMAccess

Provides access to MEM blocks in MOS items.

Methods

Method

Description

get(schema)

Returns a MEM block by schema URL, or undefined

set(block)

Creates or updates a MEM block

delete(schema)

Removes a MEM block

MOS

Represents MOS state for the current template.

Property

Type

Description

mosart?

MosartTimingValues

Viz Mosart timing values MEM

continueCount?

number

Continue count MEM

description?

string

MOS description

abstract?

string

MOS abstract

slug?

string

MOS slug

mem

MEMAccess

Access to MEM blocks

MosartTimingValues

Timing values for Viz Mosart playout.

Property

Type

Description

channel

string

Playout channel

start

string

Start time

duration

string

Duration

inMode

InMode

In mode

outMode

OutMode

Out mode

isLocator

boolean

Whether locator is enabled

InMode

"auto" | "manual"

OutMode

"auto" | "story-end" | "background-end" | "open-end"

Playout & Media Sequencer Types

VizLayer

"MAIN" | "FRONT" | "BACK"

PlayoutTarget<Layer>

Property

Type

Description

profile

string

Media Sequencer profile

channel

string

Media Sequencer channel

layer?

Layer

Viz Engine layer (default: "MAIN")

MseConnection

Provides commands executed on Media Sequencer.

Methods

Method

Description

sendVizCommand(target, ...commands)

Sends Viz Engine commands

take(target)

Executes a take command

update(target)

Executes an update command

continue(target)

Executes a continue command

out(target)

Executes an out command

checkConnection()

Returns Promise<boolean> indicating connection validity

Global app Object

The app object exposes Viz Pilot Edge application utilities.

Methods

  • app.notify(severity, message): Displays a UI toast notification.

Parameter

Type

severity

"warning" | "info" | "error" | "success"

message

string

  • app.createMseConnection(url): Creates an MseConnection.

  • app.jumpToFieldPreview(path): Jumps to a specific field's preview based on the given path.

  • app.jumpToPreviewPoint(name): Jumps to a named preview point.

Global vizrt Object

The vizrt object provides access to template fields, environment data, and lifecycle hooks.

Properties

Property

Type

Description

$env

Partial<Readonly<Record<string, string>>>

Environment variables

$pilot

PilotData

Pilot-related variables

$data

Partial<Record<string, string>>

Temporary data for dynamic editors

fields

Payload

Template field values

Events or Hooks

  • vizrt.onCreate: Called when a new data element is created in Viz Pilot Edge. Not triggered in Template Builder.

  • vizrt.onLoad: Called when an existing data element is opened in Viz Pilot Edge. Not triggered in Template Builder.

  • vizrt.onClick(name): Called when a click event is triggered from a UI element with vizrt-click-name.

  • vizrt.onUpdate(fields, action): Called from Script Runner when Update Service is configured. Not triggered in Template Builder or Viz Pilot Edge.

  • vizrt.onAfterSave: Called after the data element is saved successfully.

Global Helper Functions

  • createRichText(plainText, escape?): Creates a RichText object that can be assigned to the Formatted field type.

  • createImageAsset(image, title?): Creates an ImageAsset from a URL, path or GH ID.

  • createVideoAsset(video, title?): Creates a VideoAsset from a local file path.

  • reportErrors(f, stage): Captures errors from a callback or async chain and reports to the UI.

Deprecated

  • vizrt.jumpToPreviewPoint(name) is deprecated. Use app.jumpToPreviewPoint() instead.