SDK functions
SingularOverlay(domElement, options, callback)
Create an instance of a Singular overlay with the following code:
Attributes | Type | Required | Description |
---|---|---|---|
domId | String | Yes | The target |
options | JSON | Yes | Configuration options to define how to render an overlay. See the config option description below. |
callback | Function | Yes | Callback function called when the overlay object has been created. |
Config option description
Setting | Type | Default | Description |
---|---|---|---|
class | class | iFrameClass | Can be used to style the iframe that the overlay SDK creates. |
endpoint | String | app.singular.live | Optional. Can be used to work with different Singular servers. |
delay | String | 0 | Specified in milliseconds. It tells the overlay SDK to execute commands coming through Firebase later. |
interactive | Boolean | true | Tells the overlay if it should handle mouse events. This will simply set |
syncGraphics | Boolean | false | Tells the render engine to synchronize graphics to UTC time received by |
showPreloader | Boolean | false | Shows or hides the animation indicating that graphics are loading. |
aspect | String | empty | Defines the aspect ratio of the graphics window. When unspecified, the graphics will cover 100% of the iframe. |
Adaptive config option description
You can also use adaptive parameters to define a specific adaptive layout define in the composition.
Setting | Type | Default | Description |
---|---|---|---|
screenSize | Class | iFrameClass | Select |
layout | String | app.singular.live | |
textDirection | String | 0 | 0 ... left-to-right 1 ... right-to-left |
interactive | Boolean | false | true ... propagate interactions to overlay false ... ignore interactions |
language | String | Empty | Language code ( |
custom1 | String | Empty | Custom Parameter |
custom2 | String | Empty | Custom Parameter |
custom3 | String | Empty | Custom Parameter |
setContent(content, callback)
Loads a Singular graphic into the overlay instance.
Attributes | Type | Required | Description |
---|---|---|---|
content | String or JSON | Yes | Content can be a string or an object and contain one of the values described below. |
callback | Function | Yes | The callback function is called when content has been loaded. |
Options to define the content:
Setting | Type | Default | Description |
---|---|---|---|
string | String | - | The composition revision URL. |
compToken | String | - | The compositions token. |
appOutputToken | String | - | The app output token. |
webOutputToken | String | - | The web output token. |
Sample
Content options
Locate the Revision URL in Singular Composer
addListener(type, callback)
Adds a listener for events coming from the overlay.
Attributes | Type | Required | Description |
---|---|---|---|
type | String | Yes | An object containing one of the values described below. |
callback | Function | Yes | The callback function for the |
Values for listener type
Setting | Description |
---|---|
message | Listens to messages from interactive events and sends messages back to the video player. |
error | Listen to errors reported by the overlay instance. |
Sample: Listen to message
from interactive events
Sample: Listen to error
reported by the Overlay Instance
setDelay(delay)
Defines the delay for the execution of incoming graphics control commands.
Attributes | Type | Required | Description |
---|---|---|---|
delay | Number | Yes | Delay in milliseconds. |
Sample
show()
Shows the graphics overlay by setting the iFrame visibility to visible
.
hide()
Hides the graphics overlay by setting the iFrame visibility to hidden
.
destroy()
Deletes the graphics overlay.
videoPlaying()
Notifies the overlay SDK that the video is playing.
videoPaused()
Notifies the overlay SDK that the video is paused.
videoBuffering()
Notifies the overlay SDK that the video is buffering.
videoStopped()
Notifies the overlay SDK that the video is stopped.
videoFinished()
Notifies the overlay SDK that the video is finished.
videoSeeking(time)
Notifies the overlay SDK that the video is seeking at a specific time. Time is in seconds.
Attributes | Type | Required | Description |
---|---|---|---|
time | Number | Yes | Time in seconds. |
Sample
videoSeeked()
Notifies the overlay SDK that the seeking operation is finished.
videoTime(time)
Sends the current time of the video to the overlay SDK.
Attributes | Type | Required | Description |
---|---|---|---|
time | Number | Yes | Time in seconds. |
Sample
videoMetadata(object)
Sends information about the video. This info can be received in the interactive layer code.
Attributes | Type | Required | Description |
---|---|---|---|
object | object | Yes | add description |
videoMuted()
The user clicked the mute button in the video player.
videoUnmuted(value)
The user clicked the mute button in the video player again.
Attributes | Type | Required | Description |
---|---|---|---|
value | Number | Yes | The volume of the video. |
videoVolume(value)
The user changed the volume of the video.
Attributes | Type | Required | Description |
---|---|---|---|
value | Number | Yes | The volume of the video. |
Sample
videoAdStart(), videoAdFinished(), videoAdSkip()
The video player is playing an advertisement. The interactive layer can then hide certain graphics.
videoSegment(time)
UTC time received from the video that the overlay SDK can use to synchronize graphics to video. The format of time is Unix timestamp.
Attributes | Description | Type | Required |
---|---|---|---|
time | Time in the format of the UNIX timestamp | String | Yes |
Sample
message(object)
Send a message to the interactive layer.
Attributes | Type | Required | Description |
---|---|---|---|
object | object | Yes | Custom data as JSON object |
Sample
Last updated