---
name: "saveVideoToPhotosAlbum"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.5.0" }
platform:
  - "iOS"
  - "Android"
async: true
title: "saveVideoToPhotosAlbum - 保存视频到系统相册，支持 mp4 视频格式，需要相册权限"
---

## saveVideoToPhotosAlbum

> [VERSION] BaseKit >= 2.5.0

> [PLATFORM] iOS, Android

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

### Description

Save a video to the system photo album; supports mp4; requires album permission

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `filePath` | `string` | Yes | - | `2.5.0` | Video file path. Can be a temporary file path or a persistent file path (local path). |
| `modifyCreationDate` | `boolean` | No | `false` | `3.16.0` | Whether to modify the video's creation date Default false: do not modify the creation date. true: set the creation date to the current save time |
| `complete` | `() => void` | No | - | - | Completion callback (runs on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback function on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback function on API call failure |

#### 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` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

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