Skip to main content

Event Interface

The MaestroEventInterface protocol defines the public API through which your app can interact with MaestroKit for the currently loaded event. It is designed to handle all event-specific interactions, including playback controls, panel management, and state retrieval, ensuring that both the SDK and your app remain synchronized.

Interface

public protocol MaestroEventInterface: AnyObject {
func updateKeyPlaysData(to newData: MaestroKeyPlaysResponse?)
func didStartPlayingClip(atIndex index: Int)
func didStopPlayingClip(atIndex index: Int)
func didFailToPlayClip(atIndex index: Int)
func didUpdatePlaybackProgressOfClip(atIndex index: Int, to progress: Double)
func didShowPanel(_ panelType: MaestroPanelType)
func didHidePanel()
func didShowOverlay()
func didHideOverlay()
func currentEventDoesNotSupportKeyPlays()
func getCurrentEventID() -> String?
func getCurrentlyPlayingClipIndex() -> Int?
func getLastPlayedClipIndex() -> Int?
func getCurrentClipPlaybackProgress() -> Double?
func getKeyPlaysCount() -> Int?
func simulateUseCase(_ useCase: TestUseCase, forPanel panelType: MaestroPanelType)
}

Table of Contents

Key aspects of the MaestroEventInterface include:

  • Playback Controls:
    Methods like didStartPlayingClip(atIndex:), didStopPlayingClip(atIndex:), and didUpdatePlaybackProgressOfClip(atIndex:to:) enable you to notify the SDK of user interactions during media playback. These methods ensure that the SDK is aware of when a key play clip starts, stops, or changes progress.

  • Panel Management:
    The functions didShowPanel(_:) and didHidePanel() allow your app to inform the SDK about the visibility of the MaestroPanel, ensuring that the SDK can react appropriately to UI changes.

  • Overlay Management:
    The functions didShowOverlay() and didHideOverlay() allow your app to inform the SDK about the visibility of the MaestroOverlay, ensuring that the SDK can react appropriately to UI changes.

  • State Management:
    A data refresh method (updateKeyPlaysData(to:)) and a set of convenience methods (getCurrentEventID(), getCurrentlyPlayingClipIndex(), getLastPlayedClipIndex(), getCurrentClipPlaybackProgress(), and getKeyPlaysCount()) provides quick access to the current state of the event. This is crucial for maintaining synchronization between your app and the SDK, especially when dealing with dynamic event content.

All of these methods are designed to be executed on the main thread (as indicated by the @MainActor annotation), ensuring that any UI updates or interactions are performed seamlessly without compromising the responsiveness of your application.