Skip to main content

Maestro Event Delegate

Introduction

The MaestroEventDelegate protocol defines a set of methods that your app must implement to enable seamless communication between the MaestroKit SDK and your application. By conforming to this protocol, your app provides critical functionality, such as supplying key plays data, controlling media playback, and handling analytics tracking.

Interface

public protocol MaestroEventDelegate {
func keyPlaysData(forEventID eventID: String) -> MaestroKeyPlaysResponse
func playClip(atIndex index: Int)
func trackAction(analytics: [String: String])
func trackImpression(analytics: [String: String])
}

Table of Contents

Key Responsibilities

  • Data Provision:
    The keyPlaysData(forEventID:) method allows the SDK to request key plays data from your app. Your implementation should return a MaestroKeyPlaysResponse that keeps both the app and the SDK in sync regarding the currently cached key plays.

  • Playback Control:
    The playClip(atIndex:) and stopPlayingClip(atIndex:) methods enable the SDK to instruct your app to start or stop playing a specific key plays clip. Note that these methods assume your app has a flattened view of the key plays, independent of any sectional subdivisions.

  • Analytics Tracking:
    The trackAction(analytics:) and trackImpression(analytics:) methods provide a mechanism for the SDK to notify your app of user actions and impressions. These notifications can be used to drive custom analytics tracking within your app.

Implementing these methods is essential for ensuring that MaestroKit can manage events effectively and that your app remains synchronized with the SDK’s state and user interactions.