Panel Integration
How your channel opens the panel, hands it focus, feeds it data and mounts its modules. Assumes the setup in
Getting Started: the panel node is m.maestro.
Open and close the panel
Opening the drawer, handing it focus and restoring your layout on close are in
Getting Started, step 5. The SDK also changes
showPanel itself, for example when the viewer
engages an overlay, presses OK on the hidden panel, or holds OK to close it in builds that enable the long press. That
is why step 5 does its work in the showPanel observer.
To make room for the drawer, resize your video from the same observer: call this first in step 5's
onMaestroShowPanel, with event.getData().
' Call from onMaestroShowPanel (Getting Started, step 5): resizeVideoForMaestro(event.getData())
sub resizeVideoForMaestro(isOpen as boolean)
if isOpen
' The drawer covers the right side of the screen. m.video: your Video node
m.video.update({ translation: [50, 200], width: 1184, height: 666 })
else
m.video.update({ translation: [0, 0], width: 1920, height: 1080 })
end if
end sub
- The drawer slides in over 0.3 s.
setPanelFocus()during the slide holds focus inside the panel and moves it to the tab bar (or the overlay on screen) when the slide ends. - In the core build the drawer is 676 × 1080 and sits at x = 1244 on a 1920 × 1080 scene.
Keys and focus
Keys the panel doesn't use bubble to your scene. At the tab bar, Back and Left are not used: close the drawer there.
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
if m.maestro <> invalid and m.maestro.isInFocusChain()
if key = "back" or key = "left"
m.maestro.showPanel = false ' the showPanel observer moves focus
return true
end if
return false
end if
' ... your channel's keys
return false
end function
- With an overlay on screen, Left from the open panel moves focus to the overlay, and Right moves it back.
- With
hidePanelSelector: trueinconfigand a single panel, the tab bar is hidden and Back from inside the panel bubbles to your scene.
Open a specific panel
Set openToPanel to a panel type. The SDK selects
its tab, sets showPanel = true and focuses the tab bar. A type with no tab opens the drawer on the current tab. The
panel types on screen arrive in the rendered:channels event on
onSDKEvent: observe it in
createMaestroPanel() with observeFieldScoped.
sub onMaestroSDKEvent(event as object)
sdkEvent = event.getData()
if sdkEvent = invalid or sdkEvent.type <> "rendered:channels" then return
m.maestroPanels = []
if sdkEvent.payload <> invalid and sdkEvent.payload.panels <> invalid then m.maestroPanels = sdkEvent.payload.panels
end sub
' Your "open stats" button: opens the drawer on the first tab
sub openMaestroFirstPanel()
if m.maestro = invalid or m.maestroPanels = invalid or m.maestroPanels.count() = 0 then return
m.maestro.openToPanel = m.maestroPanels[0]
end sub
Pass data to a panel
Some panels take data only your channel has. Write it with
setDataToPanel, one panel property per write. Each panel documents
the properties it takes.
' After config (Getting Started, step 4). PANEL_TYPE, PROPERTY_A/B and their values: from the panel's page
sub sendMaestroPanelData()
m.maestro.setDataToPanel = { PANEL_TYPE: { PROPERTY_A: "valueA" } }
m.maestro.setDataToPanel = { PANEL_TYPE: { PROPERTY_B: "valueB" } }
end sub
To hide a panel or its overlays for the viewer, use userSettings.
Panel events
| Field | Fires when |
|---|---|
onPanelEvent | A panel has an event for your channel: { <event name>: data } |
userViewedPanel | A tab gets focus: { panel: <panel type> } |
focusedTabItem | The focused tab's index changes |
What Just Happened module
When the page config includes the What Just Happened panel, the SDK also provides a module: a pill your channel
mounts over the video to surface a key moment. Mount modules on
panelsBuilt, which fires on every
panel build.
sub onMaestroPanelsBuilt()
' The page config wins over stored panel data on each build: write again any property it also sets
' m.maestro.setDataToPanel = { whatJustHappened: { PROPERTY: value } }
modules = m.maestro.callFunc("fetchMaestroModule")
removeMaestroModules() ' each call returns new module nodes
for each moduleNode in modules
for each field in moduleNode.fieldsToObserve
moduleNode.observeFieldScoped(field, "onMaestroModuleEvent")
end for
m.top.appendChild(moduleNode)
if moduleNode.subType() = "WhatJustHappenedModule"
moduleNode.translation = [71, 896] ' your layout, over the video
end if
m.modules.push(moduleNode)
end for
end sub
sub onMaestroModuleEvent(event as object)
field = event.getField()
value = event.getData()
moduleNode = event.getRoSGNode()
if field = "willAppear"
show = not m.yourDialogIsOpen ' your own UI state: can the pill show now?
moduleNode.appearDecision = { appear: show, takeFocus: show }
else if field = "requestingVisibility" and value = true
moduleNode.setFocus(true)
else if field = "exploreMore"
m.maestro.openToPanel = value
else if field = "returnFocusToClient" and value = true
focusPlayer() ' your player's layout and focus
end if
end sub
' Also called from stopMaestro() (Getting Started, step 7)
sub removeMaestroModules()
if m.modules <> invalid
for each moduleNode in m.modules
hadFocus = moduleNode.isInFocusChain()
for each field in moduleNode.fieldsToObserve
moduleNode.unobserveFieldScoped(field)
end for
m.top.removeChild(moduleNode)
if hadFocus then focusPlayer()
end for
end if
m.modules = []
end sub
| Module field | Direction | Meaning |
|---|---|---|
willAppear | out | { text }: a key moment is ready. Nothing shows until you answer. |
appearDecision | in | { appear, takeFocus }. appear: false drops that key moment. |
requestingVisibility | out | true: the pill is showing and wants focus. |
exploreMore | out | The panel type to open. |
returnFocusToClient | out | true: take focus back. |
dismiss | in | true closes the pill, focused or not. |
fieldsToObserve | out | The output fields to observe. |
- Timecode required: the automatic pill surfaces only key moments at or behind the player timecode
(
onPlayerTimeCodeUpdated). - Firebase push required: the automatic pill surfaces only key moments that arrive over Firebase push. Without Firebase push for the client, no automatic pill surfaces. The feed poll feeds the panel list and the manual trigger, but never the automatic pill.
- SDK timing: the first automatic pill waits
required_time_in_session(default 50 s, counted fromfetchMaestroModule), thenvisibility_cooldown_timer(default 600 s) between pills;visibility_duration_timerauto-hides the pill (default 10 s). All come from the module's config in Maestro. - Drawer open: the automatic pill still pops over another panel, but never takes focus, whatever
takeFocussays. While the What Just Happened panel is on screen it doesn't pop. If the pill had focus when the drawer opened, the SDK takes focus back into the panel afterreturnFocusToClient: don't move focus again after a delay. - Manual trigger:
m.maestro.setDataToPanel = { whatJustHappened: { triggerModule: true } }shows the closest key moment at once, without focus, withoutwillAppearand without waiting forrequired_time_in_session. It does nothing before the first key moment. dismissOverlay()doesn't close the pill; setdismiss = true.