Overview
The SDK uses a delegate pattern to broadcast important events that occur during a session’s lifecycle. By conforming to theSukiAmbientSessionDelegate protocol, you can receive real-time updates and respond to state changes in your application, such as updating your UI or handling errors.
How To Implement The Session Delegate
1. Conform To The Protocol
First, declare that your class conforms to theSukiAmbientSessionDelegate protocol. You must also pass an instance of this delegate class when you initialize the SDK.
2. Implement The Delegate Method
Next, implement thesukiAmbient(sessionEvent:for:) method. The SDK calls this method every time a new session event occurs, providing the event type and the associated recordingId.
You can use a switch statement within this method to handle the events that are relevant to your application.
Available Session Events
TheSessionEvent enum provides the following cases, which are grouped by category for clarity.
Recording Lifecycle
Recording lifecycle events for ambient sessions.
Content Generation
Content generation events for note suggestions.
Offline Mode & Uploading
Offline mode and audio upload events.
Audio Interruptions
Audio interruption events during recording.
FAQs
Do I have any other events to listen to?
Do I have any other events to listen to?
Yes, you can listen to the following events:
sessionEventrecordingId
Can I create a new case inside the `SessionEvent` enum?
Can I create a new case inside the `SessionEvent` enum?
No, you cannot create a new case inside the
SessionEvent enum. You must use the existing cases.Why do we need so many cases for the `SessionEvent` enum?
Why do we need so many cases for the `SessionEvent` enum?
We have so many cases because we want to be able to handle all the possible events that can occur during a session.