| context | Context | Yes | Context of the ability. This parameter is optional for API version 7 and earlier versions, but mandatory for API version 8 and later versions.|
| context | Context | Yes | Context of the ability. This parameter is optional for API version 7 and earlier versions, but mandatory for API version 8 and later versions.|
| relativePath | string | Yes | Path for storing the file. You can use [getPublicDirectory](#getpublicdirectory8) to obtain the paths for storing different types of files.|
| relativePath | string | Yes | Path for storing the file. You can use [getPublicDirectory](#getpublicdirectory8) to obtain the paths for storing different types of files.|
...
@@ -208,8 +208,8 @@ Creates a media asset. This API uses a promise to return the result.
...
@@ -208,8 +208,8 @@ Creates a media asset. This API uses a promise to return the result.
| relativePath | string | Yes | Relative path. You can use [getPublicDirectory](#getpublicdirectory8) to obtain the relative path of the level-1 directory of different types of media files.|
| relativePath | string | Yes | Relative path. You can use [getPublicDirectory](#getpublicdirectory8) to obtain the relative path of the level-1 directory of different types of media files.|
...
@@ -217,7 +217,7 @@ Creates a media asset. This API uses a promise to return the result.
...
@@ -217,7 +217,7 @@ Creates a media asset. This API uses a promise to return the result.
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ------------------------ | ----------------- |
| ------------------------ | ------------- |
| [FileAsset](#fileasset8) | Media data (FileAsset).|
| [FileAsset](#fileasset8) | Media data (FileAsset).|
**Example**
**Example**
...
@@ -246,8 +246,8 @@ Obtains a public directory. This API uses an asynchronous callback to return the
...
@@ -246,8 +246,8 @@ Obtains a public directory. This API uses an asynchronous callback to return the
| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the list of URIs (starting with **dataability://**) that store the selected media assets.|
| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the list of URIs (starting with **dataability://**) that store the selected media assets.|
...
@@ -658,14 +664,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
...
@@ -658,14 +664,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Promise<Array<string>> | Promise used to return the list of URIs (starting with **dataability://**) that store the selected media assets.|
| Promise<Array<string>> | Promise used to return the list of URIs (starting with **dataability://**) that store the selected media assets.|
| isFavorite | boolean | Yes | Whether to favorite or unfavorite the file. The value **true** means to favorite the file, and **false** means to unfavorite the file.|
| isFavorite | boolean | Yes | Whether to favorite or unfavorite the file. The value **true** means to favorite the file, and **false** means to unfavorite the file.|
| isFavorite | boolean | Yes | Whether to favorite or unfavorite the file. The value **true** means to favorite the file, and **false** means to unfavorite the file.|
| isFavorite | boolean | Yes | Whether to favorite or unfavorite the file. The value **true** means to favorite the file, and **false** means to unfavorite the file.|
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ------------------- | ------------- |
| ------------------- | ---------- |
| Promise<void> | Void promise.|
| Promise<void> | Void promise.|
**Example**
**Example**
...
@@ -1225,8 +1231,8 @@ Checks whether this file asset is favorited. This API uses an asynchronous callb
...
@@ -1225,8 +1231,8 @@ Checks whether this file asset is favorited. This API uses an asynchronous callb
| isTrash | boolean | Yes | Whether to move the file asset to the trash. The value **true** means to move the file asset to the trash, and **false** means the opposite.|
| isTrash | boolean | Yes | Whether to move the file asset to the trash. The value **true** means to move the file asset to the trash, and **false** means the opposite.|
@@ -1342,14 +1348,14 @@ Files in the trash are not actually deleted. You can set **isTrash** to **false*
...
@@ -1342,14 +1348,14 @@ Files in the trash are not actually deleted. You can set **isTrash** to **false*
**Parameters**
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ------- | ------- | ---- | ------------------ |
| ------- | ------- | ---- | --------- |
| isTrash | boolean | Yes | Whether to move the file asset to the trash. The value **true** means to move the file asset to the trash, and **false** means the opposite.|
| isTrash | boolean | Yes | Whether to move the file asset to the trash. The value **true** means to move the file asset to the trash, and **false** means the opposite.|
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ------------------- | ------------- |
| ------------------- | ---------- |
| Promise<void> | Void promise.|
| Promise<void> | Void promise.|
**Example**
**Example**
...
@@ -1385,8 +1391,8 @@ Checks whether this file asset is in the trash. This API uses an asynchronous ca
...
@@ -1385,8 +1391,8 @@ Checks whether this file asset is in the trash. This API uses an asynchronous ca
| callback | AsyncCallback<boolean> | Yes | Callback used to return whether the file asset is in the trash. If the file asset is in the trash, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback<boolean> | Yes | Callback used to return whether the file asset is in the trash. If the file asset is in the trash, **true** will be returned; otherwise, **false** will be returned.|
**Example**
**Example**
...
@@ -1430,7 +1436,7 @@ Checks whether this file asset is in the trash. This API uses a promise to retur
...
@@ -1430,7 +1436,7 @@ Checks whether this file asset is in the trash. This API uses a promise to retur
| Promise<void> | Promise used to return whether the file asset is in the trash. If the file asset is in the trash, **true** will be returned; otherwise, **false** will be returned.|
| Promise<void> | Promise used to return whether the file asset is in the trash. If the file asset is in the trash, **true** will be returned; otherwise, **false** will be returned.|
**Example**
**Example**
...
@@ -1469,7 +1475,7 @@ Obtains the total number of files in the result set.
...
@@ -1469,7 +1475,7 @@ Obtains the total number of files in the result set.
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ------ | ---------------- |
| ------ | -------- |
| number | Total number of files.|
| number | Total number of files.|
**Example**
**Example**
...
@@ -1498,7 +1504,7 @@ Checks whether the cursor is in the last row of the result set.
...
@@ -1498,7 +1504,7 @@ Checks whether the cursor is in the last row of the result set.
| selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?',|
| selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?',|
| selectionArgs | Array<string> | Yes | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
| selectionArgs | Array<string> | Yes | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " AESC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"|
| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " AESC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"|
...
@@ -2185,8 +2191,8 @@ Describes options for fetching media files.
...
@@ -2185,8 +2191,8 @@ Describes options for fetching media files.
Describes the image size.
Describes the image size.
| Name | Type | Readable| Writable| Description |
| Name | Type | Readable | Writable | Description |
| src | string | Yes | URI of the media library. |
| src | string | Yes | URI of the media library. |
| mimeType | string | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.<br>Example: 'image/\*' and 'video/\*'.|
| mimeType | string | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.<br>Example: 'image/\*' and 'video/\*'.|
| relativePath | string | No | Custom path for storing media assets. If this parameter is unspecified, media assets are stored in the default path. For example, if you set this parameter to **imageDir/image2/**, the media assets will be stored in **default/imageDir/image2/**, where **default** represents the default path.|
| relativePath | string | No | Custom path for storing media assets. If this parameter is unspecified, media assets are stored in the default path. For example, if you set this parameter to **imageDir/image2/**, the media assets will be stored in **default/imageDir/image2/**, where **default** represents the default path.|
...
@@ -2213,7 +2219,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
...
@@ -2213,7 +2219,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a