onEventDataUpdated
Notifies the SDK about the new state of the currently-played event.
Overview
Call this method whenever the event being played changes. This includes starting to play a new event, switching between events, or stopping event playback. The SDK uses this information to load event-specific data and update its UI accordingly.
Syntax
fun onEventDataUpdated(data: MaestroEventData?)
Parameters
| Parameter | Type | Description |
|---|---|---|
data | MaestroEventData? | Event data for the currently playing event, or null if no event is playing |
Example
// When starting to play an event
fun onEventStarted(eventId: String) {
val eventData = MaestroEventData(
eventId = eventId,
// Other event metadata
)
sdk.onEventDataUpdated(eventData)
}
// When stopping event playback
fun onEventStopped() {
sdk.onEventDataUpdated(null)
}
// When switching to a different event
fun onEventChanged(newEventId: String) {
val newEventData = MaestroEventData(
eventId = newEventId,
)
sdk.onEventDataUpdated(newEventData)
}
Notes
- Call this method whenever the active event changes
- Pass
nullwhen no event is currently playing - The SDK uses this to load event-specific content (key plays, stats, etc.)
- This method should be called before requesting event-specific features
- Changes to event data will trigger updates throughout the SDK UI
MaestroEventDatamust have a non-blankmetadataValueto trigger event-specific content loading; a non-null object with a blankmetadataValueis treated the same asnull
info
Pass null when the user stops watching an event. This ensures correct cancellation of any background work the SDK is performing for that event. Passing a MaestroEventData object with a blank metadataValue is equivalent to passing null — no event-specific content is loaded and any active event state is cleared.
Related Methods
- configure() - Initial SDK configuration which can include event data