The Composition Script adds a JavaScript layer that is bound to your Composition. This allows you to extend on the functionality of your Composition within the Composition itself, rather than requiring this be done from a hosting website using the Graphics SDK

In addition, the Composition Script allows you to establish user-defined messages that can be generated internally by the Composition and emitted out of the Singular iFrame to your webpage using the Overlay SDK. Likewise, you can generate custom messages from your webpage that can received directly within the Composition Script.

Singular also includes a built-in script editor, allowing you to test your Composition Script functionality directly with your Composition's output, rather than deploying any code to your web environment.

The Composition Script Editor

 

Accessing the Composition Script Editor

To open up the Composition Script Editor, select the </> button above the Property Panel. The Composition Script Editor will open up in a new tab within your web browser.

Accessing the Composition Script Editor

 

The script editor provides a view of the script code, Composition Navigator, fill-in form and output - all in one view.

Also provided is a boilerplate script template that provides access to the composition's SingularPlayer object, and starter code for the object's most commonly integrated events (message, state_changed, payload_changed, datanode_payload_changed, error).

Boilerplate Script Template

Was this article helpful?
2 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.