Capture Media

This guide will walk you through capturing images and recording videos using the Truvideo Camera SDK. Whether you're building a full-featured media capture tool or adding basic camera functionality, this SDK simplifies the process with minimal setup.


Prerequisites

Before you start:

  • Make sure the Truvideo Core SDK is integrated.

  • Complete the authentication process. See: Authenticate Guide


Capturing an Image or Video

Follow these steps to configure and launch the Truvideo camera in your app.


Step 1: Get Default Camera Info

Retrieve the default configuration for the device’s camera.

let cameraInfo: TruvideoSdkCameraInformation = TruvideoSdkCamera.camera.getTruvideoSdkCameraInformation()

Step 2: Configure the Camera Settings

Set up the camera’s lens, flash, orientation, and other parameters. The SDK allows both photo and video capture in one session.

let configuration = TruvideoSdkCameraConfiguration(
    lensFacing: .back,
    flashMode: .off,
    orientation: nil,
    outputPath: "",
    frontResolutions: [],
    frontResolution: nil,
    backResolutions: [],
    backResolution: nil,
    mode: .videoAndPicture()
)

Step 3: Launch the Camera View

Use the provided configuration to present the camera interface.


Full Example Function

Here's how everything fits together into a complete Swift function:


Finali Result -

What’s Next?

Now that you can capture media, you’re ready to:


By following this guide, you’ve enabled rich media capture in your iOS app with just a few lines of code. Let’s keep going!

Last updated

Was this helpful?