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
- keyPlaysData(forEventID:)
- playClip(atIndex:)
- stopPlayingClip(atIndex:)
- trackAction(analytics:)
- trackImpression(analytics:)
Key Responsibilities
Data Provision:
ThekeyPlaysData(forEventID:)
method allows the SDK to request key plays data from your app. Your implementation should return aMaestroKeyPlaysResponse
that keeps both the app and the SDK in sync regarding the currently cached key plays.Playback Control:
TheplayClip(atIndex:)
andstopPlayingClip(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:
ThetrackAction(analytics:)
andtrackImpression(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.