---
name: "startDownloadMessageVideoForComposition"
mode: "kit"
versionRequirements:
  - { name: "IPCKit", version: "6.3.1" }
  - { name: "@ray-js/ray", version: "1.7.30" }
platform:
  - "iOS"
  - "Android"
async: true
title: "startDownloadMessageVideoForComposition"
---

## startDownloadMessageVideoForComposition

> [VERSION] IPCKit >= 6.3.1 | @ray-js/ray >= 1.7.30

> [PLATFORM] iOS, Android

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

### Description

Video download; if there are multiple video files, they will be merged into a single video file

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `6.3.1` | Device ID |
| `fileInfo` | `string` | Yes | - | `6.3.1` | File information, JSON string  {"fileInfo":[   { 	    "fileUrl": "xxx1",    "key": "media key 1"  },  {    "fileUrl": "xxx2", 	    "key": "media key 2"  }, 	  {    "fileUrl": "xxx3",    "key": "media key 3"  }] } |
| `savePath` | `number` | Yes | - | `6.3.1` | Save path: 0 (default) — save to the phone gallery; 1 — save to the App gallery; 2 — save to both the phone gallery and the App gallery |
| `option` | `MediaProcessOptionModel` | No | - | `6.3.1` | Configuration options for video processing |
| `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` | `6.3.1` | Save path after cloud storage download completes |
| `thingfilePath` | `string` | `6.7.1` | file thingfilePath |

#### 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 |


### Referenced Types

##### `interface` MediaProcessOptionModel

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `targetWidth` | `number` | `6.3.1` | Target video width |
| `targetHeight` | `number` | `6.3.1` | Target video height |
| `useFirstVideoResolution` | `boolean` | `6.3.1` | The first video's resolution takes precedence Default: true |
| `rotation` | `number` | `6.3.1` | Rotation angle. Supported: 0 (normal mode, no rotation), 1 (clockwise 90°), 2 (clockwise 180°), 3 (clockwise 270°) |


### Examples

#### Demo

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

ipc.startDownloadMessageVideoForComposition({
  deviceId: "xx",
  fileInfo: "xx",
  savePath: 1,
  option: {},
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
