Developer Portal
Quick StartsComposition scriptingAPIs and SDKsSupport
  • Portal overview
  • Quick start
  • REST API
    • Introduction
    • Rate limits
    • Authorization
    • How-to guides
      • Get a control app's API token
      • Get a composition's sub-composition IDs and names and their payload structures
      • Get a control app's model
      • Get a control app's metadata
      • Update a sub-composition's content
      • Update a sub-composition's animation state
      • Update a sub-composition's content and animation state in one call
      • Update multiple sub-compositions in one call
    • API reference
      • Get control app details
        • Get a control app's metadata
        • Get a control app's model
        • Get a control app's control data
      • Send data to a control app
        • Update a control app's content
        • Update a control app's animation state
      • Take out all of an app's output
  • Data stream API
    • Introduction
    • Rate limits
    • Authorization
    • How-to guides
      • Create a data stream
      • Link a data stream to a composition
      • Send data to an app using the data stream API
    • API reference
  • Composition scripting
    • Introduction
    • Overview
    • Quick start
      • Find sub-compositions and widgets
      • Read and update control nodes
      • Set text widget text properties
      • Read and update widget properties
      • Read control nodes and update widget properties
      • Set image widget URL property
      • Set table widget content property
    • Cheat sheets
      • Fundamentals
      • Interactive overlays
      • Best practices
    • Use cases
      • Read control nodes and generate HTML text
      • Read control nodes, generate HTML text with background
      • Text Ticker - Start ticker on "In" animation
    • Composition script editor reference
  • Software development kits
    • Graphics SDK
      • Getting started
      • Reference
        • SDK functions
        • Composition object
        • Sequencer object
      • Guides and examples
        • Load a composition with its token
        • Load a composition with its URL
        • Get the composition URL of an app instance
        • Sequencer VOD example
        • Control local preview of app
        • Load app instance output
    • Overlay SDK
      • Getting started
      • SDK functions
      • Use case examples
    • Widget SDK
      • Preparing your environment
      • Getting started
      • Reference
        • Widget UI definition
        • Widget callback functions
        • Time control object
        • Composition instance
      • Guides and examples
        • Widget example: CSS patterns
    • App SDK
  • Singular Basics
    • Overview of Singular
    • Managing overlays in the Dashboard
      • How to create a new composition
      • How to open a new app template
      • How to create an app for a composition
      • How to extract a composition from an app
      • How to find an app's shared app token and shared API URL
      • Dashboard reference
    • Building overlays in Composer
      • How to build a composition
      • How to set up layer logic to automate overlay transitions
      • How to set up control nodes to make widget properties available to a control app
      • Animating overlays
        • How to create timeline animations
        • How to create behavior animations
        • How to create update animations
      • How to make overlays interactive
      • How to adapt overlays to various screen sizes
      • Composer reference
    • Controlling overlays in Studio and UNO
      • How to use Studio
      • Studio reference
      • UNO reference
  • Support
    • Singular status
    • Support resources
    • Singular terminology
    • Performance Testing
Powered by GitBook
On this page
  • Properties
  • Methods
  • find(name)
  • getCompositionById(id)
  • getControlNode()
  • getLogicLayer()
  • getModel()
  • getPayload()
  • getPayload2()
  • getState()
  • getSubcompositionById(id)
  • jumpTo(to)
  • listSubcompositions()
  • playTo(to)
  • sendMessage(message)
  • setPayload(payload)

Was this helpful?

  1. Software development kits
  2. Graphics SDK
  3. Reference

Composition object

Properties

Name
Type
Example
Description

id

String

"303798-latest-1589207585405"

The ID of the composition.

Methods

The composition object has following methods:

Method
Return type
Brief description

Object

Returns the composition object of a sub-composition with a specified name.

Object

Returns the composition object of a sub-composition with a specified id.

Object

Returns a composition's control nodes.

getDataNode()

Object

Returns a composition's data nodes.

Object

Returns a composition's logic layers.

Object

Returns a composition's model description.

Object

Returns a composition's payload as an array.

Object

Returns a composition's payload as a JSON object.

Object

Returns a composition's state.

Object

Returns the composition object of a sub-composition with a specified id.

-

Jumps to the animation state specified by to.

Object

Returns an array of a composition's sub-compositions.

-

Plays to the animation state specified by to.

-

Sends a custom message.

-

Sets a composition's payload.

find(name)

Returns an array of composition objects with a specified name.

Parameters

Name
Type
Description

name

String

The name of the composition.

const name = "LowerThird";
// we use the first element in the array
const compObject = composition.find(name)[0];

Return

Array: An array of composition objects

compObject:
> find: Æ’ ()
> getCompositionById: Æ’ (subCompId)
> getControlNode: Æ’ ()
> getDataNodes: Æ’ ()
> getLogicLayer: Æ’ ()
> getModel: Æ’ ()
> getPayload: Æ’ ()
> getPayload2: Æ’ ()
> getState: Æ’ ()
> getSubcompositionById: Æ’ (subCompId)
> id: "dbc46c1a-1375-4c2c-9f0d-1df5a86d0baf"
> jumpTo: Æ’ (to)
> listSubcompositions: Æ’ ()
> playTo: Æ’ (to)
> seek: Æ’ (to)
> sendMessage: Æ’ (message)
> setPayload: Æ’ (payload)

See also

getCompositionById(id)

Returns the composition object of a sub-composition with a specified id.

Parameters

Name
Type
Description

id

String

The sub-composition ID.

const id = "dbc46c1a-1375-4c2c-9f0d-1df5a86d0baf";
const compObject = composition.find(id);

Return

object: Composition object

compObject:
> find: Æ’ ()
> getCompositionById: Æ’ (subCompId)
> getControlNode: Æ’ ()
> getDataNodes: Æ’ ()
> getLogicLayer: Æ’ ()
> getModel: Æ’ ()
> getPayload: Æ’ ()
> getPayload2: Æ’ ()
> getState: Æ’ ()
> getSubcompositionById: Æ’ (subCompId)
> id: "dbc46c1a-1375-4c2c-9f0d-1df5a86d0baf"
> jumpTo: Æ’ (to)
> listSubcompositions: Æ’ ()
> playTo: Æ’ (to)
> seek: Æ’ (to)
> sendMessage: Æ’ (message)
> setPayload: Æ’ (payload)

See also

getControlNode()

Returns a composition's control node model and payload.

const controlnode = compositionObject.getControlNode();

Return

object: A JSON description, if the composition has control nodes undefined: if the composition doesn't have any control nodes

{
  "id": "controlNode",
  "model": {
    "fields": {
      "3c686562-1cf3-7493-7fae-803009afa22e": {
        "defaultValue": "Default Text",
        "id": "Top Title",
        "index": 2,
        "title": "Top Title",
        "type": "text"
      },
      "502a7d0e-e0f8-a895-1b80-43cdb81a1ca9": {
        "defaultValue": "Default Text",
        "id": "Bottom Title",
        "index": 3,
        "title": "Bottom Title",
        "type": "text"
      }
    }
  },
  "name": "Control Node",
  "payload": {
    "Bottom Title": "Extra Information",
    "Top Title": "SINGULAR.LIVE"
  },
  "thumbnail": "/images/noimage.png"
}

getLogicLayer()

Returns a composition's logic layer details.

const logicLayer = compositionObject.getLogicLayer();

Return

object: a JSON description, if a logic layer has been defined for the composition

undefined: if no logic layer has been defined for the composition

{
  "name": "Lower",
  "tag": "#B0C8CD"
}

getModel()

Returns the model description of a composition's control node fields.

const model = compositionObject.getModel();

Return

object: An array of JSON objects, if the composition has control nodes

undefined: if the composition doesn't have any control nodes

[
  {
    "0": {
      "defaultValue": "Default Text",
      "id": "Top Title",
      "index": 2,
      "title": "Top Title",
      "type": "text"
    }
  },
  {
    "1": {
      "defaultValue": "Default Text",
      "id": "Bottom Title",
      "index": 3,
      "title": "Bottom Title",
      "type": "text"
    }
  }
]

getPayload()

Returns the payload of a composition's control node.

const payload = compositionObject.getPayload();

Return

object: An array of JSON objects, if the composition has control nodes

undefined: if the composition doesn't have any control nodes

[
  {
    "0": {
      "key": "Bottom Title",
      "value": "Extra Information"
    }
  },
  {
    "1": {
      "key": "Top Title",
      "value": "SINGULAR.LIVE"
    }
  }
]

getPayload2()

Returns the control node content from the composition as a JSON object.

const payload = comp.getPayload2();
console.log(payload);

getState()

Returns the composition's animation state.

const animState = compositionObject.getState();

Return

String: animation state

getState = Out

getSubcompositionById(id)

Returns the composition object of a sub-composition with a specified id.

Parameters

Name
Type
Description

id

String

ID of the sub-composition

const id = "dbc46c1a-1375-4c2c-9f0d-1df5a86d0baf";
const compObject = composition.find(id);

Return

object: Composition object

compObject:
> find: Æ’ ()
> getCompositionById: Æ’ (subCompId)
> getControlNode: Æ’ ()
> getDataNodes: Æ’ ()
> getLogicLayer: Æ’ ()
> getModel: Æ’ ()
> getPayload: Æ’ ()
> getPayload2: Æ’ ()
> getState: Æ’ ()
> getSubcompositionById: Æ’ (subCompId)
> id: "dbc46c1a-1375-4c2c-9f0d-1df5a86d0baf"
> jumpTo: Æ’ (to)
> listSubcompositions: Æ’ ()
> playTo: Æ’ (to)
> seek: Æ’ (to)
> sendMessage: Æ’ (message)
> setPayload: Æ’ (payload)

See also

jumpTo(to)

Jumps to the animation state specified by to.

compositionObject.jumpTo("In");

Return

none

listSubcompositions()

Returns an array of a composition's sub-compositions.

const subcompositionList = compositionObject.listSubcompositions();

Return

object: An array of JSON objects

[ { "id": "a4db02c8-df43-4737-a43d-ba9a4430cd86", "name": "Lower 1 Line - Large" } ]

playTo(to)

Plays to the animation state specified by to.

compositionObject.playTo("In");

Return

none

sendMessage(message)

Attributes
Type
Required
Description

object

object

Yes

Custom data as JSON object

setPayload(payload)

Sets the payload of a composition's control nodes.

const payload = {
  "Bottom Title": "Extra Information",
  "Top Title": "SINGULAR.LIVE",
};
compositionObject.setPayload(payload);

Return

none

PreviousSDK functionsNextSequencer object

Last updated 2 years ago

Was this helpful?

Send a message to the composition. Use the to receive the message in the .

Composition object
Composition object
Composition object
message listener
Composition Script
find(name)
getCompositionById(id)
getControlNode()
getLogicLayer()
getModel()
getPayload()
getPayload2()
getState()
getSubcompositionById(id)
jumpTo(to)
listSubcompositions()
playTo(to)
sendMessage(message)
setPayload(payload)