Skip to main content

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. The diagram below illustrates the possible states of a session and the methods that cause a transition from one state to another.

Prerequisites

Before calling any of these methods, always ensure the SDK is initialized and a session has been created to prevent runtime errors.
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.

Recording controls

These are the recording controls that are available in the Mobile SDK:

Start Recording

You can begin capturing audio by calling the start method. This transitions the session into the Recording state.
do {
    // Begins the recording process for the active session.
    try SukiAmbientCore.shared.start()
} catch {
    // Handle potential errors, e.g., session not initialized.
    print(error)
}

Pause Recording

To temporarily stop capturing audio while keeping the session active, call the pause method. This transitions the session into the Paused state.
do {
    // Pauses the current recording. The session remains active.
    try SukiAmbientCore.shared.pause()
} catch {
    // Handle errors, e.g., no active recording to pause.
    print(error)
}

Resume Recording

If a session is paused, you can call the resume method to continue capturing audio. This transitions the session into the Recording state.
do {
    // Resumes a paused recording.
    try SukiAmbientCore.shared.resume()
} catch {
    // Handle errors, e.g., the session was not in a paused state.
    print(error)
}

End Session

To stop the recording and begin the content generation process, call the end method. This is the standard way to complete a session successfully.
do {
    // Ends the recording and triggers the note generation process.
    try SukiAmbientCore.shared.end()
} catch {
    // Handle errors, e.g., the session was already ended.
    print(error)
}

Cancel Session

To stop the recording and discard all captured data, call the cancel method. This action cannot be undone.
do {
    // Stops the recording and aborts the session. No content will be generated.
    try SukiAmbientCore.shared.cancel()
} catch {
    // Handle potential errors.
    print(error)
}

Error Handling

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.

FAQs

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.
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.
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.
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.
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.
Yes, you can pause and resume a session. The pause and resume methods transition the session into the Paused and Recording states, respectively.
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.
You can check the sessionState property to determine the current state of the session.
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, the audio and session data will be discarded.

Next Steps

After you have started a recording, you can proceed to the Session Status & Retrieve Content guide to check the status of the session and retrieve the generated content.
I