Capture Recording
The SDK captures a recording when your user shakes the device or takes a screenshot - actions considered as triggers. You can extend this capability by incorporating your own additional triggers.
For instance, you might want to capture a recording when your user presses a button in your app or completes a specific sequence.
However you capture the recording, the SDK user interface will always appear to let your users review the footage, edit and submit.
Select a Trigger and Capture Recording
Select a Trigger
Decide from what event you want to capture the video, for example a button press. We will call this the trigger. This very simple example shows a possible trigger - when a button is pressed in a SwiftUI app.
Capture the recording from the Trigger
Place an import statement to import the SDK at the top of the file containing the trigger (the event which will trigger the capture of the recording). For example, this might be a View Controller, or a View. Note that we also provide the optional surveyName parameter here, so potentially if you have designed a number of different in-app surveys, then you can specify which one to show at different trigger points.
Call triggerCaptureRecording
(Swift), triggerCaptureRecordingAndReturnError
(Objective-C), at the moment you want to capture the video inside the trigger, handling any errors thrown:
The only error the SDK throws is the FlightRecorderSDKError.failedToStart
error. To effectively handle this error, consider logging it directly to the console, or alternatively, utilize your preferred logging framework.
If you do encounter the FlightRecorderSDKError.failedToStart
error, it indicates that the triggerCaptureRecording
function was called before initializing the FlightRecorderSDK
with the start
function.
To resolve this issue, ensure that you call FlightRecorderSDK.start
during your application's initialization phase as shown in the SDK Configuration section, before invoking any recording functions.
Here is the completed SwiftUI example, completed by calling the method from the onButtonClick function:
Last updated