Capture Media
This documentation provides guidelines on capturing images and recording videos using the TruVideo Camera SDK. The SDK offers simple methods to integrate camera functionalities into your application.
Prerequisites
Ensure you have integrated the TruVideo Core SDK into your project and completed with the authentication process
Capturing an Image
To capture an image, follow these steps:
Step 1: Create new configuration to give to the camera
const cameraConfiguration : CameraConfiguration = {
lensFacing: LensFacing?.Front,
//lensFacing: LensFacing?.Back,
flashMode: FlashMode?.Off,
//flashMode: FlashMode?.On
orientation: Orientation?.Portrait,
//orientation: Orientation?.LandscapeLeft,
//orientation: Orientation?.LandscapeRight,
//orientation: Orientation?.Portrai
outputPath: "",
frontResolutions: [],
frontResolution: null,
backResolutions: [],
backResolution: null,
mode: CameraMode.videoAndImage()
//mode: CameraMode.image()
//mode: CameraMode.video()
imageFormat : ImageFormat.JPEG
}Step 2 : Present the camera with the configuration
For Type Checked Camera Response new method introduces initCameraScreenTS
Step 4 : Format the response
Finalize :
After completing this steps the function should look like
Media Item Object
The result contains an array of MediaItem objects, where each MediaItem represents a media file (e.g., video) captured or stored by the application. Below is a description of the properties included in each MediaItem object.
id
Number
A unique identifier for the media.
filePath
String
The file path where the media item is stored on the device.
duration
Number
The duration of the media item in milliseconds (0 for images).
orientation
String
The orientation of the media item (PORTRAIT or LANDSCAPE).
lensFacing
String
The camera lens used to capture the media (BACK or FRONT).
resolution
Object
An object containing the dimensions of the media item (width and height).
createdAt
Number
The timestamp (in milliseconds) when the media item was created.
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?