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
info
Send null when the event is not relevant (not playing) any longer. This ensures proper cancellation of any work the SDK may be doing to observe the changes of the event.
Related Methods
- configure() - Initial SDK configuration which can include event data