Skip to main content

Core SDK

Introduction​

The Core SDK provides the fundamental fields and methods for initializing and configuring the Maestro Roku SDK. These configurable fields and functions serve as the entry point for integrating the SDK into your Roku application and allow you to configure behavior, manage event lifecycles, and control the panel.

SDK Component​

The Maestro Roku SDK is distributed as a remote ComponentLibrary. Once loaded, you create the main panel component:

m.lib = createObject("roSGNode", "MaestroPanelLib:MaestroPanel")

Key Responsibilities​

  • SDK Configuration: The config field initializes the SDK with your site ID, event ID, authentication tokens, and environment settings. This is typically set after configuring other fields and triggers the API requests.

  • Event Lifecycle Management: The userDidStartWatchingEvent field manages the lifecycle of events, triggering a new panel session when a user switches to different content.

  • Panel Control: Fields like width, height, displayQRCodes, and functions like setPanelFocus() control the panel's appearance and behavior.

  • Data Management: The setDataToPanel field allows you to push external data into specific panels, while getDataFromPanel() retrieves data using a polling model.

  • Resource Cleanup: The destroySDK() function performs a clean teardown, removing all field observers and hiding the panel when you're done with the SDK. Use restartSDK() to reset and re-initialize the SDK without recreating the node.

Configurable Fields​

These fields are set by the client application to control SDK behavior:

FieldTypeDescription
configassocArrayPrimary configuration object; triggers Maestro config fetch
configurationassocArrayPasses runtime configuration to SDK panels, overriding server-side defaults
displayQRCodesbooleanEnables/disables QR code display
fetchDataOnInitbooleanFetch panel data on load (default: true)
handleLoadingSceneActionstringCommunicates loading actions to your app
heightintegerPanel height; alias of panelManagerView.height
sendTestOverlaystring"fantasy" or "bet" triggers an overlay test event
setDataToPanelassocArrayPushes external data into panel (depends on panel type)
userDidStartWatchingEventstringUsed when user switches content; triggers new panel session
userSettingsassocArrayOverride default panel/overlay/user behavior
widthintegerPanel width; alias of panelManagerView.width

Public Functions​

These functions can be called to control SDK behavior:

FunctionDescription
destroySDK()Clean teardown; removes all listeners
fetchMaestroModule()Returns configured SDK overlay modules for mounting in the host scene
getDataFromPanel()Returns panel data (polling model)
onPlayerTimeCodeUpdated()Passes player timecode to SDK
setConfiguration()Applies runtime configuration to SDK panels
restartSDK()Destroys and re-initializes the SDK without removing the node
setPanelFocus()Moves Roku focus into the panel

Usage Pattern​

The typical initialization pattern follows these steps:

  1. Load the ComponentLibrary
  2. Create the MaestroPanel node
  3. Observe essential fields (trackingEvent, errorInformation, etc.)
  4. Set configurable fields (width, height, displayQRCodes)
  5. Set the config object (triggers initialization)
  6. Append the panel to your scene
sub onLibraryLoadStatusChanged()
if m.componentLibrary.loadStatus = "ready"
m.lib = createObject("roSGNode", "MaestroPanelLib:MaestroPanel")

' Observe fields
m.lib.observeField("trackingEvent", "onTrackingEvent")
m.lib.observeField("errorInformation", "onErrorInformation")

' Set dimensions
m.lib.width = 1280
m.lib.height = 720

' Configure (must be last)
m.lib.config = {
siteID: "your-site-id",
eventID: "your-event-id",
useProdEnv: true
}

m.top.appendChild(m.lib)
end if
end sub