---
name: "privacyProtectDetectForVideo"
mode: "kit"
versionRequirements:
  - { name: "AIKit", version: "1.2.0" }
  - { name: "@ray-js/ray", version: "1.7.9" }
platform:
  - "iOS"
  - "Android"
async: true
title: "privacyProtectDetectForVideo"
---

## privacyProtectDetectForVideo

> [VERSION] AIKit >= 1.2.0 | @ray-js/ray >= 1.7.9

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Run privacy region recognition on a video

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `inputVideoPath` | `string` | Yes | - | `1.2.0` | Video input path |
| `outputVideoPath` | `string` | Yes | - | `1.2.0` | Video output path |
| `videoConfig` | `1 \| 2 \| 3 \| 4` | No | `4` | `1.2.0` | Video configuration -- defaults to 1080 |
| `detectType` | `1 \| 2` | No | `1` | `1.2.0` | Recognition type |
| `imageEditType` | `1 \| 2 \| 3` | No | `1` | `1.2.0` | Image processing type |
| `musicPath` | `string` | Yes | - | `1.2.0` | Local path of background music |
| `audioEditType` | `1 \| 2 \| 3` | No | `1` | `1.2.0` | Audio processing type |
| `originAudioVolume` | `number` | No | `0.5` | `1.2.0` | Original audio volume |
| `overlayAudioVolume` | `number` | No | `0.5` | `1.2.0` | Overlay audio volume |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `path` | `string` | `1.2.0` | Output path |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Valid Values

##### `videoConfig` valid values

| Value | Description |
| --- | --- |
| `1` | 480 |
| `2` | 540 |
| `3` | 720 |
| `4` | 1080 (default) |

##### `detectType` valid values

| Value | Description |
| --- | --- |
| `1` | Pets |
| `2` | People |

##### `imageEditType` valid values

| Value | Description |
| --- | --- |
| `1` | No effect |
| `2` | Emphasize subject |
| `3` | Privacy protection |

##### `audioEditType` valid values

| Value | Description |
| --- | --- |
| `1` | No processing |
| `2` | 0.5 0.5 mixing |
| `3` | Mute video |


### Examples

#### Basic usage

```tsx
import { ai } from '@ray-js/ray'

const { privacyProtectDetectForVideo } = ai;

privacyProtectDetectForVideo({
  inputVideoPath: 'example',
  outputVideoPath: 'example',
  musicPath: 'example',
  success: (result) => {
    console.log('privacyProtectDetectForVideo success', result);
  },
  fail: (error) => {
    console.log('privacyProtectDetectForVideo fail', error.errorMsg);
  },
});
```
