未验证 提交 1b64e459 编写于 作者: O openharmony_ci 提交者: Gitee

!7877 翻译完成:6668 媒体文档优化

Merge pull request !7877 from wusongqing/TR6668
...@@ -2103,7 +2103,7 @@ Creates a **PhotoOutput** instance. This API uses an asynchronous callback to re ...@@ -2103,7 +2103,7 @@ Creates a **PhotoOutput** instance. This API uses an asynchronous callback to re
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------------------------------------------- | ---- | ----------------------------------- | | --------- | ------------------------------------------- | ---- | ----------------------------------- |
| surfaceId | string | Yes | Surface ID received from **ImageReceiver**. | | surfaceId | string | Yes | Surface ID received from **[ImageReceiver](js-apis-image.md#imagereceiver9)**. |
| callback | AsyncCallback<[PhotoOutput](#photooutput)\> | Yes | Callback used to return the **PhotoOutput** instance.| | callback | AsyncCallback<[PhotoOutput](#photooutput)\> | Yes | Callback used to return the **PhotoOutput** instance.|
**Example** **Example**
...@@ -2130,7 +2130,7 @@ Creates a **PhotoOutput** instance. This API uses a promise to return the instan ...@@ -2130,7 +2130,7 @@ Creates a **PhotoOutput** instance. This API uses a promise to return the instan
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------ | ---- | --------------------------------- | | --------- | ------ | ---- | --------------------------------- |
| surfaceId | string | Yes | Surface ID received from **ImageReceiver**.| | surfaceId | string | Yes | Surface ID received from **[ImageReceiver](js-apis-image.md#imagereceiver9)**. |
**Return value** **Return value**
......
...@@ -15,6 +15,8 @@ getMediaLibrary(context: Context): MediaLibrary ...@@ -15,6 +15,8 @@ getMediaLibrary(context: Context): MediaLibrary
Obtains a **MediaLibrary** instance, which is used to access and modify personal media data such as audios, videos, images, and documents. Obtains a **MediaLibrary** instance, which is used to access and modify personal media data such as audios, videos, images, and documents.
This API can be used only in the stage model.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
**Parameters** **Parameters**
...@@ -49,6 +51,8 @@ getMediaLibrary(): MediaLibrary ...@@ -49,6 +51,8 @@ getMediaLibrary(): MediaLibrary
Obtains a **MediaLibrary** instance, which is used to access and modify personal media data such as audios, videos, images, and documents. Obtains a **MediaLibrary** instance, which is used to access and modify personal media data such as audios, videos, images, and documents.
This API can be used only in the FA model.
> **NOTE** > **NOTE**
> >
> This API is no longer maintained since API version 8. You are advised to use [mediaLibrary.getMediaLibrary<sup>8+</sup>](#medialibrarygetmedialibrary8) instead. > This API is no longer maintained since API version 8. You are advised to use [mediaLibrary.getMediaLibrary<sup>8+</sup>](#medialibrarygetmedialibrary8) instead.
...@@ -256,17 +260,12 @@ Creates a media asset. This API uses a promise to return the result. ...@@ -256,17 +260,12 @@ Creates a media asset. This API uses a promise to return the result.
**Example** **Example**
``` ```
async function example() { let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
// Create an image file in promise mode. media.getPublicDirectory(DIR_CAMERA).then(function(dicResult){
let mediaType = mediaLibrary.MediaType.IMAGE; console.info("getPublicDirectory successfully:"+ JSON.stringify(dicResult));
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; }).catch(function(err){
const path = await media.getPublicDirectory(DIR_IMAGE); console.info("getPublicDirectory failed with error:"+ err);
media.createAsset(mediaType, "image01.jpg", path + 'myPicture/').then (function (asset) { });
console.info("createAsset successfully:"+ JSON.stringify(asset));
}).catch(function(err){
console.info("createAsset failed with error:"+ err);
});
}
``` ```
### getPublicDirectory<sup>8+</sup> ### getPublicDirectory<sup>8+</sup>
...@@ -578,7 +577,7 @@ Starts image preview. This API can be used to preview local images whose URIs st ...@@ -578,7 +577,7 @@ Starts image preview. This API can be used to preview local images whose URIs st
> **NOTE** > **NOTE**
> >
> This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **<Image\>** component can be used to render and display local images and network images. > This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\<Image>** component can be used to render and display local and online images.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -620,7 +619,7 @@ Starts image preview, with the first image to preview specified. This API can be ...@@ -620,7 +619,7 @@ Starts image preview, with the first image to preview specified. This API can be
> **NOTE** > **NOTE**
> >
> This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **<Image\>** component can be used to render and display local images and network images. > This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\<Image>** component can be used to render and display local and online images.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -960,8 +959,8 @@ open(mode: string): Promise&lt;number&gt; ...@@ -960,8 +959,8 @@ open(mode: string): Promise&lt;number&gt;
Opens this file asset. This API uses a promise to return the result. Opens this file asset. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource. > Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA **Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
...@@ -1934,13 +1933,11 @@ async function example() { ...@@ -1934,13 +1933,11 @@ async function example() {
extendArgs: "", extendArgs: "",
}; };
let fetchFileResult = await media.getFileAssets(getImageOp); let fetchFileResult = await media.getFileAssets(getImageOp);
fetchFileResult.getPositionObject(1, (err, fileAsset) => { fetchFileResult.getPositionObject(1) .then(function (fileAsset){
if (err) { console.log('[Demo] fileAsset.displayName : ' + fileAsset.displayName);
console.error('Failed '); }).catch(function (err) {
return; console.info("[Demo] getFileAssets failed with error:" + err);
} });
console.log('fileAsset.displayName : ' + fileAsset.displayName);
})
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册