diff --git a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
index da6168229c6c24ff3230dec69ab5f41547ba00fe..019bc319ac2c1245cef25558b8390a4672347495 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
@@ -203,8 +203,8 @@ on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------- |
-| type | string | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
'audioChange': 音频文件变更
'videoChange': 视频文件变更
'fileChange': 文件变更
'remoteFileChange': 注册设备上文件变更 |
-| callback | callback<void> | 是 | 回调返回空 |
+| type | 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange' | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
'audioChange': 音频文件变更
'videoChange': 视频文件变更
'fileChange': 文件变更
'remoteFileChange': 注册设备上文件变更 |
+| callback | Callback<void> | 是 | 回调返回空 |
**示例:**
@@ -225,8 +225,8 @@ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------- |
-| type | string | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
'audioChange': 音频文件变更
'videoChange': 视频文件变更
'fileChange': 文件变更
'remoteFileChange': 注册设备上文件变更 |
-| callback | callback<void> | 否 | 回调返回空 |
+| type | 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange' | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
'audioChange': 音频文件变更
'videoChange': 视频文件变更
'fileChange': 文件变更
'remoteFileChange': 注册设备上文件变更 |
+| callback | Callback<void> | 否 | 回调返回空 |
**示例:**
@@ -346,8 +346,6 @@ async function example() {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()],
};
- const context = getContext(this);
- var media = mediaLibrary.getMediaLibrary(context);
const fetchFileResult = await media.getFileAssets(option);
let asset = await fetchFileResult.getFirstObject();
if (asset == undefined) {
@@ -390,8 +388,6 @@ async function example() {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [fileType.toString()],
};
- const context = getContext(this);
- var media = mediaLibrary.getMediaLibrary(context);
const fetchFileResult = await media.getFileAssets(option);
let asset = await fetchFileResult.getFirstObject();
if (asset == undefined) {
@@ -559,7 +555,6 @@ release(callback: AsyncCallback<void>): void
**示例:**
```js
-var media = mediaLibrary.getMediaLibrary(context);
media.release((err) => {
// do something
});
@@ -882,8 +877,6 @@ getActivePeers(): Promise\>;
```js
async function example() {
- const context = getContext(this);
- var media = mediaLibrary.getMediaLibrary(context);
media.getActivePeers().then((devicesInfo) => {
if (devicesInfo != undefined) {
for (let i = 0; i < devicesInfo.length; i++) {
@@ -920,8 +913,6 @@ getActivePeers(callback: AsyncCallback\>): void;
```js
async function example() {
- const context = getContext(this);
- var media = mediaLibrary.getMediaLibrary(context);
media.getActivePeers((err, devicesInfo) => {
if (devicesInfo != undefined) {
for (let i = 0; i < devicesInfo.length; i++) {
@@ -957,8 +948,6 @@ getAllPeers(): Promise\>;
```js
async function example() {
- const context = getContext(this);
- var media = mediaLibrary.getMediaLibrary(context);
media.getAllPeers().then((devicesInfo) => {
if (devicesInfo != undefined) {
for (let i = 0; i < devicesInfo.length; i++) {
@@ -995,8 +984,6 @@ getAllPeers(callback: AsyncCallback\>): void;
```js
async function example() {
- const context = getContext(this);
- var media = mediaLibrary.getMediaLibrary(context);
media.getAllPeers((err, devicesInfo) => {
if (devicesInfo != undefined) {
for (let i = 0; i < devicesInfo.length; i++) {
@@ -2470,12 +2457,12 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
-| 名称 | 说明 |
-| ----- | ---- |
-| FILE | 文件 |
-| IMAGE | 图片 |
-| VIDEO | 视频 |
-| AUDIO | 音频 |
+| 名称 | 值 | 说明 |
+| ----- | ---- | ---- |
+| FILE | 0 | 文件 |
+| IMAGE | 1 | 图片 |
+| VIDEO | 2 | 视频 |
+| AUDIO | 3 | 音频 |
## FileKey8+
@@ -2483,7 +2470,7 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
-| 名称 | 默认值 | 说明 |
+| 名称 | 值 | 说明 |
| ------------- | ------------------- | ---------------------------------------------------------- |
| ID | file_id | 文件编号 |
| RELATIVE_PATH | relative_path | 相对公共目录路径 |
@@ -2511,14 +2498,14 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
-| 名称 | 说明 |
-| ------------- | ------------------ |
-| DIR_CAMERA | 表示Camera文件路径 |
-| DIR_VIDEO | 表示视频路径 |
-| DIR_IMAGE | 表示图片路径 |
-| DIR_AUDIO | 表示音频路径 |
-| DIR_DOCUMENTS | 表示文档路径 |
-| DIR_DOWNLOAD | 表示下载路径 |
+| 名称 | 值 | 说明 |
+| ------------- | --- | ------------------ |
+| DIR_CAMERA | 0 | 表示Camera文件路径 |
+| DIR_VIDEO | 1 | 表示视频路径 |
+| DIR_IMAGE | 2 | 表示图片路径 |
+| DIR_AUDIO | 3 | 表示音频路径 |
+| DIR_DOCUMENTS | 4 | 表示文档路径 |
+| DIR_DOWNLOAD | 5 | 表示下载路径 |
## DeviceType8+
@@ -2528,15 +2515,15 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.DistributedCore
-| 名称 | 说明 |
-| ------------ | ---------- |
-| TYPE_UNKNOWN | 未识别设备 |
-| TYPE_LAPTOP | 笔记本电脑 |
-| TYPE_PHONE | 手机 |
-| TYPE_TABLET | 平板电脑 |
-| TYPE_WATCH | 智能手表 |
-| TYPE_CAR | 车载设备 |
-| TYPE_TV | 电视设备 |
+| 名称 | 值 | 说明 |
+| ------------ | --- | ---------- |
+| TYPE_UNKNOWN | 0 | 未识别设备 |
+| TYPE_LAPTOP | 1 | 笔记本电脑 |
+| TYPE_PHONE | 2 | 手机 |
+| TYPE_TABLET | 3 | 平板电脑 |
+| TYPE_WATCH | 4 | 智能手表 |
+| TYPE_CAR | 5 | 车载设备 |
+| TYPE_TV | 6 | 电视设备 |
## MediaFetchOptions7+
@@ -2544,14 +2531,14 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
-| 名称 | 类型 | 可读 | 可写 | 必填 | 说明 |
-| ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ |
-| selections | string | 是 | 是 | 是 | 检索条件,使用[FileKey](#filekey8)中的枚举值作为检索条件的列名。示例:
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
-| selectionArgs | Array<string> | 是 | 是 | 是 | 检索条件的值,对应selections中检索条件列的值。
示例:
selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
-| order | string | 是 | 是 | 否 | 检索结果排序方式,使用[FileKey](#filekey8)中的枚举值作为检索结果排序的列,可以用升序或降序排列。示例:
升序排列:order: mediaLibrary.FileKey.DATE_ADDED + " ASC"
降序排列:order: mediaLibrary.FileKey.DATE_ADDED + " DESC" |
-| uri8+ | string | 是 | 是 | 否 | 文件URI |
-| networkId8+ | string | 是 | 是 | 否 | 注册设备网络ID |
-| extendArgs8+ | string | 是 | 是 | 否 | 扩展的检索参数,目前没有扩展检索参数 |
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ----------------------- | ------------------- | ---- | ---- | ------------------------------------------------------------ |
+| selections | string | 是 | 是 | 检索条件,使用[FileKey](#filekey8)中的枚举值作为检索条件的列名。示例:
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
+| selectionArgs | Array<string> | 是 | 是 | 检索条件的值,对应selections中检索条件列的值。
示例:
selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
+| order | string | 是 | 是 | 检索结果排序方式,使用[FileKey](#filekey8)中的枚举值作为检索结果排序的列,可以用升序或降序排列。示例:
升序排列:order: mediaLibrary.FileKey.DATE_ADDED + " ASC"
降序排列:order: mediaLibrary.FileKey.DATE_ADDED + " DESC" |
+| uri8+ | string | 是 | 是 | 文件URI |
+| networkId8+ | string | 是 | 是 | 注册设备网络ID |
+| extendArgs8+ | string | 是 | 是 | 扩展的检索参数,目前没有扩展检索参数 |
## Size8+
@@ -2573,11 +2560,11 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
-| 名称 | 类型 | 必填 | 描述 |
-| ------------ | ------ | ---- | ------------------------------------------------------------ |
-| src | string | 是 | 本地文件应用沙箱路径。 |
-| mimeType | string | 是 | 媒体MIME(Multipurpose Internet Mail Extensions)类型。
包括:'image/\*'、'video/\*'、'audio/\*'、 'file\*'。 |
-| relativePath | string | 否 | 自定义媒体资源保存位置,例:Pictures/ 不填则保存到默认路径。
image类型默认路径Pictures/
video类型默认路径Videos/
audio类型默认路径Audios/
file类型默认路径Documents/ 。 |
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ------------ | ------ | ---- | ---- | ------------------------------------------------------------ |
+| src | string | 是 | 是 | 本地文件应用沙箱路径。 |
+| mimeType | string | 是 | 是 | 媒体MIME(Multipurpose Internet Mail Extensions)类型。
包括:'image/\*'、'video/\*'、'audio/\*'、 'file\*'。 |
+| relativePath | string | 是 | 是 | 自定义媒体资源保存位置,例:Pictures/ 不填则保存到默认路径。
image类型默认路径Pictures/
video类型默认路径Videos/
audio类型默认路径Audios/
file类型默认路径Documents/ 。 |
## MediaSelectOption(deprecated)
@@ -2587,9 +2574,9 @@ async function example() {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
-| 名称 | 类型 | 必填 | 描述 |
-| ----- | ------ | ---- | -------------------- |
-| type | string | 是 | 媒体类型,包括:image, video, media,当前仅支持media类型 |
-| count | number | 是 | 媒体选择,count = 1表示单选,count大于1表示多选。 |
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ----- | ------ | ---- | ---- | -------------------- |
+| type | string | 是 | 是 | 媒体类型,包括:image, video, media,当前仅支持media类型 |
+| count | number | 是 | 是 | 媒体选择,count = 1表示单选,count大于1表示多选。 |