> For the complete documentation index, see [llms.txt](https://doc.ozforensics.com/oz-knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/ios/capturing-videos.md).

# Capturing Videos

## OzCapsula (SDK v8.22 and newer)

{% hint style="warning" %}
Please note: all required data (other than the video) must be packaged into the container before starting the Liveness screen.
{% endhint %}

Create a controller that will capture videos as follows:

```swift
getSessionToken() { sessionToken in
            DispatchQueue.main.async {
                do {
                    let action:OZVerificationMovement = .selfie
                    let mediaRequest = MediaRequest.action(action)
                    let profile = AnalysisProfile(mediaList: [mediaRequest],
                                                  type: .quality,
                                                  params: [:] )
                    let request = CaptureRequest(analysisProfileList: [profile], cameraPosition: .front)
                    let ozLivenessVC = try OZSDK.createMediaCaptureScreen(self, request, sessionToken: sessionToken)
                    self.present(ozLivenessVC, animated: true)
                } catch let error {
                    print(error.localizedDescription)
                }
            }
        }
```

<details>

<summary>For multi-gesture scenarios</summary>

{% code title="" expandable="true" %}

```swift
let mediaRequest1 = MediaRequest.action(.scanning)
let mediaRequest2 = MediaRequest.action(.eyes)
let mediaRequest3 = MediaRequest.action(.smile)

let profile = AnalysisProfile(
    mediaList: [mediaRequest1, mediaRequest2, mediaRequest3],
    type: .quality,
    params: [:]
)

let request = CaptureRequest(
    analysisProfileList: [profile],
    cameraPosition: .front
)

let livenessVC = try OZSDK.createMediaCaptureScreen(
    delegate,
    request,
    sessionToken: sessionToken          // from Step 3
)

livenessVC.modalPresentationStyle = .fullScreen
parent.present(livenessVC, animated: true)
```

{% endcode %}

</details>

The delegate object must implement the `OZLivenessDelegate` protocol:

```swift
extension ViewController: LivenessDelegate {
    func onResult(container: DataContainer) {
    }
    func onError(status: OZVerificationStatus?) {
    }
}
```

## SDK 8.21 and older

Create a controller that will capture videos as follows:

```objectivec
let actions: [OZVerificationMovement] = [.selfie]
let ozLivenessVC: UIViewController = OZSDK.createVerificationVCWithDelegate(self, actions: actions)
self.present(ozLivenessVC, animated: true)
```

`action` – a list of user’s [actions](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/ios/pages/BVX89LL3HSWuDVvGUadK#h.20yp3ix24ijd) while capturing the video.

Once video is captured, the system calls the `onOZLivenessResult` method:

```swift
extension viewController: OZLivenessDelegate {
 func onError(status: OZVerificationStatus?) {
        // show error
   }
 }
 func onOZLivenessResult(results: [OZMedia]) {
   // proceed to the checks step
 }
}
```

The method returns the results of video capturing: the `[`[`OZMedia`](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/ios/pages/BVX89LL3HSWuDVvGUadK#h.hizmhq9c5cq9)`]` objects. The system uses these objects to perform checks.

{% hint style="info" %}
If you use our SDK just for capturing videos, omit the Checking Liveness and Face Biometry step.
{% endhint %}

If a user closes the capturing screen manually, the `failedBecauseUserCancelled` error appears.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/ios/capturing-videos.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
