The following global helper functions are available in the script API.
Function | Description |
|---|---|
| Creates a RichText object that can be assigned to the Formatted field type. |
| Creates an ImageAsset object that can be assigned to Image fields. |
| Creates a VideoAsset object that can be assigned to Video fields. |
| Transmits possible errors (exceptions) occurring within a callback/async call, to the UI. |
Examples
Image fields can be assigned by using the createImageAsset method. This method accepts any of the three input references to an image: UUID or path to an image on the Graphic Hub, or a full URL to an image:
vizrt.fields.$insta.$image2.value = createImageAsset("IMAGE*<520E0100-56BD-5C4D-884D-5598ACFD75A4>")vizrt.fields.$insta.$image2.value = createImageAsset("IMAGE*01_GLOBALS/IMAGE/logo_wide")vizrt.fields.$insta.$image2.value = createImageAsset("https://images.pexels.com/photos/169647/pexels-photo-169647.jpeg", "HEY")Video fields can be assigned by using the createVideoAsset method. This method accepts a full path to a clip on a disk:
vizrt.fields.$00Video.value = createVideoAsset("C:\\clips\\CVJPHFMXDHBGZFMF.mxf", "Title")The file path must be accessible on the Viz Engine that plays out this clip.
Formatted Text fields can be assigned by creating an object of type RichText in the method createRichText:
vizrt.fields.$name.onChanged = value => { vizrt.fields["$01-richtext"].value = createRichText( `<fo:wrapper bold="false" italic="false" underline="false">Hello </fo:wrapper>` + `<fo:wrapper bold="true" italic="true" underline="true">${value}!</fo:wrapper>`, false)}Info: The second argument to the method is set to false. This ensures the formatted text is sent to the Viz Engine unescaped. If set to true, the text is escaped, but the formatting is lost.
false: When the actual RichText XML should be sent to the Viz Engine.
true: When the text does not contain RichText, but contains characters that require escaping, such as < and >.