---
name: "saveVideoToPhotosAlbum"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.5.0" }
  - { name: "@ray-js/ray", version: "0.5.9" }
platform:
  - "iOS"
  - "Android"
async: true
---

## saveVideoToPhotosAlbum

> [VERSION] BaseKit >= 2.5.0 | @ray-js/ray >= 0.5.9

> [PLATFORM] iOS, Android

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

### Description

Save video to the system photo album. Supports MP4 format and requires album permission

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `filePath` | `string` | Yes | - | `2.5.0` | Video file path; can be a temporary or permanent file path (local path) |
| `modifyCreationDate` | `boolean` | No | `false` | `3.16.0` | Whether to modify the video's creation date Default: false (do not modify). true: set the video's creation date to the current save time |
| `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 |
| --- | --- | --- | --- |
| `localIdentifier` | `string` | `3.14.0` | Album video identifier |

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


### Examples

#### Demo

```tsx
import { downloadFile, saveVideoToPhotosAlbum } from '@ray-js/ray'

// Save the video to the system album (requires album permission): download first, then save using the scheme path
downloadFile({
  url: "https://airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com/ttttestfile/test_video.mp4",
  success: ({ tempFilePath }) => {
    saveVideoToPhotosAlbum({
      filePath: tempFilePath,
      modifyCreationDate: false,
      success: data => console.log("Saved, album identifier:", data.localIdentifier),
      fail: error => console.error(error),
    });
  },
  fail: error => console.error(error),
});
```
