Overview
The Mobile SDK provides you the capability to manage the full lifecycle of an ambient session using the following recording controls. These methods allow you to start, pause, resume, and stop a recording with full state management.What Will You Learn?
In this guide, you will learn how to:- Handle the recording lifecycle using the
start,pause,resume,end, andcancelmethods. - Handle errors from the recording control methods.
- Understand the best practices for handling user interactions with the recording controls.
Prerequisites
Before calling any of these methods, always ensure the SDK is initialized and a session has been created to prevent runtime errors.Recording controls
These are the recording controls that are available in the Mobile SDK:Start Recording
You can begin capturing audio by calling thestart method. This transitions the session into the Recording state.
Pause Recording
To temporarily stop capturing audio while keeping the session active, call thepause method. This transitions the session into the Paused state.
Resume Recording
If a session is paused, you can call theresume method to continue capturing audio. This transitions the session into the Recording state.
End Session
To stop the recording and begin the content generation process, call theend method. This is the standard way to complete a session successfully.
Cancel Session
To stop the recording and discard all captured data, call thecancel method. This action cannot be undone.
Error Handling
All recording control methods can throw aSukiAmbientCoreError. You must use a do-catch block to handle potential issues, such as calling a method from an invalid state.
FAQs
Why can't I start a recording in the background?
Why can't I start a recording in the background?
iOS does not allow an app to start a recording while it is in the background. If you attempt this, the SDK will throw an
appIsNotActive error. You should handle this case by notifying the user.What happens if I call a method from an invalid state?
What happens if I call a method from an invalid state?
All recording control methods can throw a
SukiAmbientCoreError. You must use a do-catch block to handle potential issues, such as calling a method from an invalid state.How do I handle errors from the recording control methods?
How do I handle errors from the recording control methods?
All recording control methods can throw a
SukiAmbientCoreError. You must use a do-catch block to handle potential issues, such as calling a method from an invalid state.Do I need to call the `end` method to generate a note?
Do I need to call the `end` method to generate a note?
Yes, you must call the
end method to generate a note. The end method transitions the session into the Ended state, which is required for note generation.Can I cancel a session after it has been ended?
Can I cancel a session after it has been ended?
No, you cannot cancel a session after it has been ended. The
cancel method transitions the session into the Canceled state, which is required for note generation.Can I pause and resume a session?
Can I pause and resume a session?
Yes, you can pause and resume a session. The
pause and resume methods transition the session into the Paused and Recording states, respectively.Can I start a recording after it has been ended?
Can I start a recording after it has been ended?
No, you cannot start a recording after it has been ended. The
start method transitions the session into the Recording state, which is required for note generation.As a developer, how do I know if a session has been ended?
As a developer, how do I know if a session has been ended?
You can check the
sessionState property to determine the current state of the session.What is the best way to handle user interactions with the recording controls?
What is the best way to handle user interactions with the recording controls?
You should use the
sessionState property to determine the current state of the session and only enable the recording controls when the session is in the Recording state.If the user cancels a session, what happens to the audio and session data?
If the user cancels a session, what happens to the audio and session data?
If the user cancels a session, the audio and session data will be discarded.