From 2bd6e6ce48de1782eb8b8159f18a87a79cb3d403 Mon Sep 17 00:00:00 2001 From: panqiangbiao Date: Sun, 6 Mar 2022 10:50:36 +0800 Subject: [PATCH] fix code issue Signed-off-by: panqiangbiao --- .../reference/apis/js-apis-medialibrary.md | 226 +++++++++--------- 1 file changed, 113 insertions(+), 113 deletions(-) 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 7723c69dc0..0f2fad66ff 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @@ -1,11 +1,13 @@ 媒体库管理 ========== - +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 该组件从API Version 6开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + 导入模块 --------- ``` -import medialibrary from '@ohos.multimedia.medialibrary'; +import mediaLibrary from '@ohos.multimedia.medialibrary'; ``` @@ -19,7 +21,7 @@ function getMediaLibrary(context: Context): MediaLibrary; **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core -**参数:** +**参数:** | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------- | @@ -29,19 +31,18 @@ function getMediaLibrary(context: Context): MediaLibrary; | 类型 | 说明 | | ------------ | :----- | -| MediaLibrary | 媒体库实例 | +| mediaLibrary | 媒体库实例 | **示例:** ``` import featureAbility from '@ohos.ability.featureAbility'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; var context = featureAbility.getContext() -var mediaLibrary = mediaLibrary.getMediaLibrary(context); +var media = mediaLibrary.getMediaLibrary(context); ``` -## medialibrary.getFileAssets +## mediaLibrary.getFileAssets8+ getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileResult>): void; @@ -68,9 +69,9 @@ let imagesfetchOp = { selections: fileKeyObj.MEDIA_TYPE + '= ?', selectionArgs: [imageType.toString()], }; -medialibrary.getFileAssets(imagesfetchOp, (error, fetchFileResult) => { +mediaLibrary.getFileAssets(imagesfetchOp, (error, fetchFileResult) => { if (fetchFileResult != undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK fetchFileResult success'); + console.info('mediaLibraryTest : ASSET_CALLBACK fetchFileResult success'); fetchFileResult.getAllObject((err, fileAssetList) => { if (fileAssetList != undefined) { fileAssetList.forEach(getAllObjectInfo); @@ -79,7 +80,7 @@ medialibrary.getFileAssets(imagesfetchOp, (error, fetchFileResult) => { } }); ``` -## medialibrary.getFileAssets +## mediaLibrary.getFileAssets8+ getFileAssets(options: MediaFetchOptions): Promise<FetchFileResult>; @@ -110,14 +111,14 @@ let imagesfetchOp = { selections: fileKeyObj.MEDIA_TYPE + '= ?', selectionArgs: [imageType.toString()], }; -medialibrary.getFileAssets(imagesfetchOp).then(function(fetchFileResult){ +mediaLibrary.getFileAssets(imagesfetchOp).then(function(fetchFileResult){ console.info("getFileAssets successfully:"+ JSON.stringify(dir)); }).catch(function(err){ console.info("getFileAssets failed with error:"+ err); }); ``` -## medialibrary.on +## mediaLibrary.on8+ on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; @@ -131,17 +132,17 @@ on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'| | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------- | ---- | ------------------- | -| type | type | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
’audioChange‘:  音频文件变更
‘videoChange’:  视频文件变更
‘'fileChange':  文件变更
‘remoteFileChange’: 注册设备上文件变更 | +| type | type | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
'audioChange':  音频文件变更
'videoChange':  视频文件变更
'fileChange':  文件变更
'remoteFileChange': 注册设备上文件变更 | | callback | callback<void> | 是 | 回调返回空 | **示例:** ``` -medialibrary.on('imageChange', () => { +mediaLibrary.on('imageChange', () => { // image file had changed, do something }) ``` -## medialibrary.off +## mediaLibrary.off8+ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; @@ -157,24 +158,24 @@ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange' | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------- | ---- | ------------------- | -| type | type | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
’audioChange‘:  音频文件变更
‘videoChange’:  视频文件变更
‘'fileChange':  文件变更
‘remoteFileChange’: 注册设备上文件变更 | +| type | type | 是 | 媒体类型
'deviceChange': 注册设备变更
'albumChange': 相册变更
'imageChange': 图片文件变更
'audioChange':  音频文件变更
'videoChange':  视频文件变更
'fileChange':  文件变更
'remoteFileChange': 注册设备上文件变更 | | callback | callback<void> | 否 | 回调返回空 | **示例:** ``` -medialibrary.off('imageChange', () => { +mediaLibrary.off('imageChange', () => { // stop listening success }) ``` -## medialibrary.createAsset +## mediaLibrary.createAsset 8+ createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback<FileAsset>): void; 创建媒体资源,使用callback方式返回结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -193,7 +194,7 @@ createAsset(mediaType: MediaType, displayName: string, relativePath: string, cal // 使用Callback方式创建Image类型文件 let mediaType = mediaLibrary.MediaType.IMAGE; let path = "Pictures/"; -medialibrary.createAsset(mediaType, “imageCallBack.jpg”, path, (err, fileAsset) => { +mediaLibrary.createAsset(mediaType, 'imageCallBack.jpg', path, (err, fileAsset) => { if (fileAsset != undefined) { console.info('createAsset successfully, message = ' + err); } else { @@ -202,13 +203,13 @@ medialibrary.createAsset(mediaType, “imageCallBack.jpg”, path, (err, fileAss }); ``` -## medialibrary.createAsset +## mediaLibrary.createAsset8+ createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise<FileAsset>; 创建媒体资源,使用Promise方式返回结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -232,14 +233,14 @@ createAsset(mediaType: MediaType, displayName: string, relativePath: string): Pr // 使用Promise方式创建Image类型文件 let mediaType = mediaLibrary.MediaType.IMAGE; let path = "Pictures/"; -medialibrary.createAsset(mediaType, "image01.jpg", path).then (function (asset) { +mediaLibrary.createAsset(mediaType, "image01.jpg", path).then (function (asset) { console.info("createAsset successfully:"+ JSON.stringify(asset)); }).catch(function(err){ console.info("createAsset failed with error:"+ err); }); ``` -## medialibrary.getPublicDirectory +## mediaLibrary.getPublicDirectory8+ getPublicDirectory(type: DirectoryType, callback: AsyncCallback<string>): void; @@ -261,16 +262,16 @@ getPublicDirectory(type: DirectoryType, callback: AsyncCallback<string>): ``` let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; -media.getPublicDirectory(DIR_CAMERA,(err, dicResult) => { +media.getPublicDirectory(DIR_CAMERA, (err, dicResult) => { if (dicResult == 'camera/') { - console.info('MediaLibraryTest : getPublicDirectory'); + console.info('mediaLibraryTest : getPublicDirectory passed'); } else { - console.info('MediaLibraryTest : getPublicDirectory failed'); + console.info('mediaLibraryTest : getPublicDirectory failed'); } }); ``` -## medialibrary.getPublicDirectory +## mediaLibrary.getPublicDirectory8+ getPublicDirectory(type: DirectoryType): Promise<string>; @@ -306,7 +307,7 @@ async function (done) { } ``` -## medialibrary.getAlbums +## mediaLibrary.getAlbums6+ getAlbums(options: MediaFetchOptions, callback: AsyncCallback): void; @@ -330,7 +331,7 @@ let AlbumNoArgsfetchOp = { selections: '', selectionArgs: [], }; -medialibrary.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => { +mediaLibrary.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => { if (albumList != undefined) { const album = albumList[0]; console.info('album.albumName = ' + album.albumName); @@ -341,7 +342,7 @@ medialibrary.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => { }) ``` -## medialibrary.getAlbums +## mediaLibrary.getAlbums6+ getAlbums(options: MediaFetchOptions): Promise; @@ -370,18 +371,18 @@ let AlbumNoArgsfetchOp = { selections: '', selectionArgs: [], }; -medialibrary.getAlbums(AlbumNoArgsfetchOp).then(function(albumList){ +mediaLibrary.getAlbums(AlbumNoArgsfetchOp).then(function(albumList){ console.info("getAlbums successfully:"+ JSON.stringify(albumList)); }).catch(function(err){ console.info("getAlbums failed with error:"+ err); }); ``` -## medialibrary.release +## mediaLibrary.release8+ release(callback: AsyncCallback<void>): void; -释放MediaLibrary实例,当用户确认后续不再使用MediaLibrary实例中的方法后调用release方法释放MediaLibrary实例。 +释放mediaLibrary实例,当用户确认后续不再使用mediaLibrary实例中的方法后调用release方法释放mediaLibrary实例。 **需要权限**:无 @@ -396,17 +397,17 @@ release(callback: AsyncCallback<void>): void; **示例:** ``` -var mediaLibrary = mediaLibrary.getMediaLibrary(context); -mediaLibrary.release((err, data) => { +var media = mediaLibrary.getMediaLibrary(context); +media.release((err, data) => { // do something }); ``` -## medialibrary.release +## mediaLibrary.release8+ release(): Promise<void>; -释放MediaLibrary实例,当用户确认后续不再使用MediaLibrary实例中的方法后调用release方法释放MediaLibrary实例。 +释放mediaLibrary实例,当用户确认后续不再使用mediaLibrary实例中的方法后调用release方法释放mediaLibrary实例。 **需要权限**:无 @@ -421,11 +422,11 @@ release(): Promise<void>; **示例:** ``` -var mediaLibrary = mediaLibrary.getMediaLibrary(context); -mediaLibrary.release() +var media = mediaLibrary.getMediaLibrary(context); +media.release() ``` -## FileAsset.isDirectory +## FileAsset.isDirectory8+ isDirectory(callback: AsyncCallback<boolean>): void; @@ -460,7 +461,7 @@ async function (done) { } ``` -## FileAsset.isDirectory +## FileAsset.isDirectory8+ isDirectory():Promise<boolean>; @@ -497,13 +498,13 @@ async function (done) { } ``` -## FileAsset.commitModify +## FileAsset.commitModify8+ commitModify(callback: AsyncCallback<void>): void; 修改文件的元数据,使用callback方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -526,20 +527,20 @@ async function (done) { }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.title = ‘newtitle'; + asset.title = 'newtitle'; asset.commitModify(() => { console.info('commitModify success'); - } + }); } ``` -## FileAsset.commitModify +## FileAsset.commitModify8+ commitModify(): Promise<void>; 修改文件的元数据,使用promise方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -562,18 +563,18 @@ async function (done) { }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.title = ‘newtitle'; + asset.title = 'newtitle'; asset.commitModify(); } ``` -## FileAsset.open +## FileAsset.open8+ open(mode: string, callback: AsyncCallback<number>): void; 打开当前文件,使用callback方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA(‘w’模式打开) +**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA('w'模式打开) **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -601,13 +602,13 @@ async function (done) { } ``` -## FileAsset.open +## FileAsset.open8+ open(mode: string): Promise<number>; 打开当前文件,使用promise方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA(‘w’模式打开) +**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA('w'模式打开) **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -640,13 +641,13 @@ async function (done) { } ``` -## FileAsset.close +## FileAsset.close8+ close(fd: number, callback: AsyncCallback<void>): void; 关闭当前文件,使用callback方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -672,8 +673,8 @@ async function (done) { const asset = await fetchFileResult.getFirstObject(); asset.close(fd, (closeErr) => { if (closeErr != undefined) { - console.info('MediaLibraryTest : close : FAIL ' + closeErr.message); - console.info('MediaLibraryTest : ASSET_CALLBACK : FAIL'); + console.info('mediaLibraryTest : close : FAIL ' + closeErr.message); + console.info('mediaLibraryTest : ASSET_CALLBACK : FAIL'); } else { console.info("=======asset.close success====>"); } @@ -681,13 +682,13 @@ async function (done) { } ``` -## FileAsset.close +## FileAsset.close8+ close(fd: number): Promise<void>; 关闭当前文件,使用promise方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -718,8 +719,8 @@ async function (done) { const asset = await fetchFileResult.getFirstObject(); asset.close(fd).then((closeErr) => { if (closeErr != undefined) { - console.info('MediaLibraryTest : close : FAIL ' + closeErr.message); - console.info('MediaLibraryTest : ASSET_CALLBACK : FAIL'); + console.info('mediaLibraryTest : close : FAIL ' + closeErr.message); + console.info('mediaLibraryTest : ASSET_CALLBACK : FAIL'); } else { console.info("=======asset.close success====>"); @@ -728,7 +729,7 @@ async function (done) { } ``` -## FileAsset.getThumbnail +## FileAsset.getThumbnail8+ getThumbnail(callback: AsyncCallback<image.PixelMap>): void; @@ -758,12 +759,12 @@ async function (done) { const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.getThumbnail((err, pixelmap) => { - console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap); + console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap); }); } ``` -## FileAsset.getThumbnail +## FileAsset.getThumbnail8+ getThumbnail(size: Size, callback: AsyncCallback<image.PixelMap>): void; @@ -794,12 +795,12 @@ async function (done) { const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.getThumbnail(size, (err, pixelmap) => { - console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap); + console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap); }); } ``` -## FileAsset.getThumbnail +## FileAsset.getThumbnail8+ getThumbnail(size?: Size): Promise<image.PixelMap>; @@ -835,18 +836,18 @@ async function (done) { const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.getThumbnail(size, (err, pixelmap) => { - console.info('MediaLibraryTest : getThumbnail Successfull '+ pixelmap); + console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap); }); } ``` -## FileAsset.favorite +## FileAsset.favorite8+ favorite(isFavorite: boolean, callback: AsyncCallback<void>): void; 将文件设置为收藏文件,使用callback方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -876,13 +877,13 @@ async function (done) { } ``` -## FileAsset.favorite +## FileAsset.favorite8+ favorite(isFavorite: boolean): Promise<void>; 将文件设置为收藏文件,使用promise方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -919,7 +920,7 @@ async function (done) { } ``` -## FileAsset.isFavorite +## FileAsset.isFavorite8+ isFavorite(callback: AsyncCallback<boolean>): void; @@ -958,7 +959,7 @@ async function (done) { } ``` -## FileAsset.isFavorite +## FileAsset.isFavorite8+ isFavorite():Promise<boolean>; @@ -995,7 +996,7 @@ async function (done) { } ``` -## FileAsset.trash +## FileAsset.trash8+ trash(isTrash: boolean, callback: AsyncCallback<void&g;): void; @@ -1003,7 +1004,7 @@ trash(isTrash: boolean, callback: AsyncCallback<void&g;): void; 放入垃圾文件夹的文件不会被真正删除,可以通过isTrash = false参数恢复成正常文件。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -1029,12 +1030,12 @@ async function (done) { const asset = await fetchFileResult.getFirstObject(); asset.trash(true, trashCallBack); function trashCallBack(err, trash) { - console.info('MediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK trash'); + console.info('mediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK trash'); } } ``` -## FileAsset.trash +## FileAsset.trash8+ trash(isTrash: boolean,): Promise<void>; @@ -1042,7 +1043,7 @@ trash(isTrash: boolean,): Promise<void>; 放入垃圾文件夹的文件不会被真正删除,可以通过isTrash = false参数恢复成正常文件。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -1079,7 +1080,7 @@ async function (done) { } ``` -## FileAsset.isTrash +## FileAsset.isTrash8+ isTrash(callback: AsyncCallback<boolean>): void; @@ -1111,19 +1112,19 @@ async function (done) { asset.isTrash(isTrashCallBack); function isTrashCallBack(err, isTrash) { if (isTrash == true) { - console.info('MediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK isTrash = ' + isTrash); + console.info('mediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK isTrash = ' + isTrash); asset.trash(true, trashCallBack); } else { - console.info('MediaLibraryTest : ASSET_CALLBACK isTrash Unsuccessfull = ' + err); - console.info('MediaLibraryTest : ASSET_CALLBACK isTrash : FAIL'); + console.info('mediaLibraryTest : ASSET_CALLBACK isTrash Unsuccessfull = ' + err); + console.info('mediaLibraryTest : ASSET_CALLBACK isTrash : FAIL'); } } } ``` -## FileAsset.isTrash +## FileAsset.isTrash8+ isTrash():Promise<boolean>; @@ -1164,7 +1165,7 @@ async function (done) { 文件检索结果集。 -## FetchFileResult.getCount +## FetchFileResult.getCount8+ getCount(): number; @@ -1195,7 +1196,7 @@ async function (done) { } ``` -## FetchFileResult.isAfterLast +## FetchFileResult.isAfterLast8+ isAfterLast(): boolean; @@ -1224,15 +1225,15 @@ async function (done) { }; let fetchFileResult = await media.getFileAssets(getImageOp); const fetchCount = fetchFileResult.getCount(); - console.info('MediaLibraryTest : count:' + fetchCount); + console.info('mediaLibraryTest : count:' + fetchCount); let fileAsset = await fetchFileResult.getFirstObject(); for (var i = 1; i < fetchCount; i++) { fileAsset = await fetchFileResult.getNextObject(); if(i == fetchCount - 1) { - console.info('MediaLibraryTest : isLast'); + console.info('mediaLibraryTest : isLast'); var result = fetchFileResult.isAfterLast(); - console.info('MediaLibraryTest : isAfterLast:' + result); - console.info('MediaLibraryTest : isAfterLast end'); + console.info('mediaLibraryTest : isAfterLast:' + result); + console.info('mediaLibraryTest : isAfterLast end'); fetchFileResult.close(); } @@ -1240,7 +1241,7 @@ async function (done) { } ``` -## FetchFileResult.close +## FetchFileResult.close8+ close(): void; @@ -1266,7 +1267,7 @@ async function (done) { } ``` -## FetchFileResult.getFirstObject +## FetchFileResult.getFirstObject8+ getFirstObject(callback: AsyncCallback<FileAsset>): void; @@ -1304,7 +1305,7 @@ async function (done) { } ``` -## FetchFileResult.getFirstObject +## FetchFileResult.getFirstObject8+ getFirstObject(): Promise<FileAsset>; @@ -1341,7 +1342,7 @@ async function (done) { } ``` -## FetchFileResult.getNextObject +## FetchFileResult.getNextObject8+ getNextObject(callback: AsyncCallback<FileAsset>): void; @@ -1379,7 +1380,7 @@ async function (done) { } ``` -## FetchFileResult.getNextObject +## FetchFileResult.getNextObject8+ getNextObject(): Promise<FileAsset>; @@ -1408,12 +1409,12 @@ async function (done) { }; let fetchFileResult = await media.getFileAssets(getImageOp); const fetchCount = fetchFileResult.getCount(); - console.info('MediaLibraryTest : count:' + fetchCount); + console.info('mediaLibraryTest : count:' + fetchCount); fileAsset = await fetchFileResult.getNextObject(); } ``` -## FetchFileResult.getLastObject +## FetchFileResult.getLastObject8+ getLastObject(callback: AsyncCallback<FileAsset>): void; @@ -1451,7 +1452,7 @@ async function (done) { } ``` -## FetchFileResult.getLastObject +## FetchFileResult.getLastObject8+ getLastObject(): Promise<FileAsset>; @@ -1483,7 +1484,7 @@ async function (done) { } ``` -## FetchFileResult.getPositionObject +## FetchFileResult.getPositionObject8+ getPositionObject(index: number, callback: AsyncCallback<FileAsset>): void; @@ -1512,7 +1513,7 @@ async function (done) { extendArgs: "LIMIT 0,10", }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(1,(err, value) => { + fetchFileResult.getPositionObject(0, (err, value) => { if (err) { console.error('Failed '); return; @@ -1522,7 +1523,7 @@ async function (done) { } ``` -## FetchFileResult.getPositionObject +## FetchFileResult.getPositionObject8+ getPositionObject(index: number): Promise<FileAsset>; @@ -1556,7 +1557,7 @@ async function (done) { extendArgs: "LIMIT 0,10", }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(1,(err, value) => { + fetchFileResult.getPositionObject(1, (err, value) => { if (err) { console.error('Failed '); return; @@ -1566,7 +1567,7 @@ async function (done) { } ``` -## FetchFileResult.getAllObject +## FetchFileResult.getAllObject8+ getAllObject(callback: AsyncCallback<Array<FileAsset>>): void; @@ -1604,7 +1605,7 @@ async function (done) { } ``` -## FetchFileResult.getAllObject +## FetchFileResult.getAllObject8+ getAllObject(): Promise<Array<FileAsset>>; @@ -1636,13 +1637,13 @@ async function (done) { } ``` -## Album.commitModify +## Album.commitModify8+ commitModify(callback: AsyncCallback<void>): void; 更新相册属性修改到数据库中。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -1673,13 +1674,13 @@ async function (done) { } ``` -## Album.commitModify +## Album.commitModify8+ commitModify(): Promise<void>; 更新相册属性修改到数据库中。 -**需要权限**:ohos.permission.READ_MEDIA,ohos.permission.WRITE_MEDIA +**需要权限**:ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -1708,7 +1709,7 @@ async function (done) { } ``` -## Album.getFileAssets +## Album.getFileAssets8+ getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileResult>): void; @@ -1736,14 +1737,13 @@ async function (done) { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; album.getFileAssets(fileNoArgsfetchOp, getFileAssetsCallBack); - }) function getFileAssetsCallBack(err, fetchFileResult) { // do something } } ``` -## Album.getFileAssets +## Album.getFileAssets8+ getFileAssets(options?: MediaFetchOptions): Promise<FetchFileResult>; @@ -1783,7 +1783,7 @@ async function (done) { } ``` -## PeerInfo +## PeerInfo8+ 注册设备信息。 @@ -1908,7 +1908,7 @@ DeviceType | TYPE_CAR | 5 | 车载设备 | | TYPE_TV | 6 | 电视设备 | -## MediaFetchOptions +## MediaFetchOptions8+ 检索条件。 @@ -1921,7 +1921,7 @@ DeviceType | networkId | string | 是 | 是 | 否 |注册设备网络ID | | extendArgs | string | 是 | 是 | 否 |扩展的检索参数 | -## Size +## Size8+ 图片尺寸。 -- GitLab