未验证 提交 76846da5 编写于 作者: O openharmony_ci 提交者: Gitee

!5242 翻译完成:4609 一致性+敏感词修改

Merge pull request !5242 from wusongqing/TR4609V2
...@@ -467,8 +467,6 @@ Enumerates the hints provided along with audio interruption. ...@@ -467,8 +467,6 @@ Enumerates the hints provided along with audio interruption.
Enumerates the returned event types for audio interruption events. Enumerates the returned event types for audio interruption events.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Default Value| Description | | Name | Default Value| Description |
...@@ -528,8 +526,6 @@ Describes the interruption event received by the application when playback is in ...@@ -528,8 +526,6 @@ Describes the interruption event received by the application when playback is in
Describes input parameters of audio interruption events. Describes input parameters of audio interruption events.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
...@@ -542,8 +538,6 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a ...@@ -542,8 +538,6 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
Describes the callback invoked for audio interruption or focus gain events. Describes the callback invoked for audio interruption or focus gain events.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
...@@ -618,10 +612,10 @@ Enumerates the audio source types. ...@@ -618,10 +612,10 @@ Enumerates the audio source types.
**System capability**: SystemCapability.Multimedia.Audio.Core **System capability**: SystemCapability.Multimedia.Audio.Core
| Name | Default Value| Description | | Name | Default Value| Description |
| :------------------------------ | :----- | :----------------------------------------------------------- | | :------------------------------ | :----- | :--------------------- |
| SOURCE_TYPE_INVALID | -1 | Invalid audio source. | | SOURCE_TYPE_INVALID | -1 | Invalid audio source. |
| SOURCE_TYPE_MIC | 0 | Mic source. | | SOURCE_TYPE_MIC | 0 | Mic source. |
| SOURCE_TYPE_VOICE_COMMUNICATION | 7 | Voice communication source.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| | SOURCE_TYPE_VOICE_COMMUNICATION | 7 | Voice communication source.|
## AudioScene<sup>8+</sup><a name="audioscene"></a> ## AudioScene<sup>8+</sup><a name="audioscene"></a>
...@@ -1605,8 +1599,6 @@ off(type: 'deviceChange', callback?: Callback<DeviceChangeAction\>): void ...@@ -1605,8 +1599,6 @@ off(type: 'deviceChange', callback?: Callback<DeviceChangeAction\>): void
Unsubscribes from device change events. Unsubscribes from device change events.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Multimedia.Audio.Device **System capability**: SystemCapability.Multimedia.Audio.Device
**Parameters** **Parameters**
...@@ -1630,8 +1622,6 @@ on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\<InterruptAc ...@@ -1630,8 +1622,6 @@ on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\<InterruptAc
Subscribes to audio interruption events. When the application's audio is interrupted by another playback event, the application will receive the callback. Subscribes to audio interruption events. When the application's audio is interrupted by another playback event, the application will receive the callback.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters** **Parameters**
...@@ -1668,15 +1658,13 @@ off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\<Interrupt ...@@ -1668,15 +1658,13 @@ off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\<Interrupt
Unsubscribes from audio interruption events. Unsubscribes from audio interruption events.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | | --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to subscribe to. The value **interrupt** means the audio interruption event, which is triggered when the audio playback of the current application is interrupted by another application.| | type | string | Yes | Type of event to unsubscribe from. The value **interrupt** means the audio interruption event, which is triggered when the audio playback of the current application is interrupted by another application.|
| interrupt | AudioInterrupt | Yes | Audio interruption event type. | | interrupt | AudioInterrupt | Yes | Audio interruption event type. |
| callback | Callback<[InterruptAction](#interruptaction)> | No | Callback invoked for the audio interruption event. | | callback | Callback<[InterruptAction](#interruptaction)> | No | Callback invoked for the audio interruption event. |
...@@ -1853,19 +1841,13 @@ promise.then(function (value) { ...@@ -1853,19 +1841,13 @@ promise.then(function (value) {
Provides APIs for audio rendering. Before calling any API in **AudioRenderer**, you must use [createAudioRenderer](#audiocreateaudiorenderer8) to create an **AudioRenderer** instance. Provides APIs for audio rendering. Before calling any API in **AudioRenderer**, you must use [createAudioRenderer](#audiocreateaudiorenderer8) to create an **AudioRenderer** instance.
**System capability**: SystemCapability.Multimedia.Audio.Renderer ### Attributes
### state<sup>8+</sup>
Readonly state: AudioState **System capability**: SystemCapability.Multimedia.Audio.Renderer
Defines the state of the audio renderer.
**Parameters**
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----- | -------------------------- | ---- | ---- | ------------------ | | ----- | -------------------------- | ---- | ---- | ------------------ |
| state | [AudioState](#audiostate8) | Yes | No | Audio renderer state.| | state<sup>8+</sup> | [AudioState](#audiostate8) | Yes | No | Audio renderer state.|
**Example** **Example**
...@@ -2668,17 +2650,13 @@ audioRenderer.on('stateChange', (state) => { ...@@ -2668,17 +2650,13 @@ audioRenderer.on('stateChange', (state) => {
Provides APIs for audio capture. Before calling any API in **AudioCapturer**, you must use [createAudioCapturer](#audiocreateaudiocapturer8) to create an **AudioCapturer** instance. Provides APIs for audio capture. Before calling any API in **AudioCapturer**, you must use [createAudioCapturer](#audiocreateaudiocapturer8) to create an **AudioCapturer** instance.
### state<sup>8+</sup> ### Attributes
Readonly state: AudioState
Defines the audio capturer state.
**System capability**: SystemCapability.Multimedia.Audio.Capturer **System capability**: SystemCapability.Multimedia.Audio.Capturer
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| :---- | :------------------------- | :--- | :--- | :--------------- | | :---- | :------------------------- | :--- | :--- | :--------------- |
| state | [AudioState](#audiostate8) | Yes | No | Audio capturer state.| | state<sup>8+</sup> | [AudioState](#audiostate8) | Yes| No | Audio capturer state.|
**Example** **Example**
...@@ -3204,7 +3182,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th ...@@ -3204,7 +3182,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| :------- | :----------------------- | :--- | :------------------------------------------ | | :------- | :----------------------- | :--- | :------------------------------------------ |
| type | string | Yes | Type of event to subscribe to. The value **periodReach** means the period reached event, which is triggered when the period of frame capturing reaches the value of the **frame** parameter.| | type | string | Yes | Type of event to subscribe to. The value **periodReach** means the period reached event, which is triggered when the period of frame capturing reaches the value of the **frame** parameter.|
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. | | frame | number | Yes | Period during which frame rendering is listened. The value must be greater than **0**. |
| callback | (position: number) => {} | Yes | Callback invoked when the event is triggered. | | callback | (position: number) => {} | Yes | Callback invoked when the event is triggered. |
**Example** **Example**
......
...@@ -12,7 +12,7 @@ import image from '@ohos.multimedia.image'; ...@@ -12,7 +12,7 @@ import image from '@ohos.multimedia.image';
``` ```
## image.createPixelMap<sup>8+</sup> ## image.createPixelMap<sup>8+</sup>
createPixelMap(colors: ArrayBuffer, options: InitializetionOptions): Promise\<PixelMap> createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<PixelMap>
Creates a **PixelMap** object. This API uses a promise to return the result. Creates a **PixelMap** object. This API uses a promise to return the result.
...@@ -41,7 +41,7 @@ image.createPixelMap(Color, opts) ...@@ -41,7 +41,7 @@ image.createPixelMap(Color, opts)
## image.createPixelMap<sup>8+</sup> ## image.createPixelMap<sup>8+</sup>
createPixelMap(colors: ArrayBuffer, options: InitializetionOptions, callback: AsyncCallback\<PixelMap>): void createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback\<PixelMap>): void
Creates a **PixelMap** object. This API uses an asynchronous callback to return the result. Creates a **PixelMap** object. This API uses an asynchronous callback to return the result.
...@@ -470,7 +470,7 @@ Creates an **ImageSource** instance based on the URI. ...@@ -470,7 +470,7 @@ Creates an **ImageSource** instance based on the URI.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------------- | | ------ | ------ | ---- | ---------------------------------- |
| uri | string | Yes | Image source URI. Currently, only the local absolute path is supported.| | uri | string | Yes | Image path. Currently, only the application sandbox path is supported.|
**Return value** **Return value**
...@@ -481,7 +481,8 @@ Creates an **ImageSource** instance based on the URI. ...@@ -481,7 +481,8 @@ Creates an **ImageSource** instance based on the URI.
**Example** **Example**
```js ```js
const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg') let path = this.context.getApplicationContext().fileDirs + "test.jpg";
const imageSourceApi = image.createImageSource(path);
``` ```
## image.createImageSource<sup>7+</sup> ## image.createImageSource<sup>7+</sup>
...@@ -801,7 +802,7 @@ Provide APIs to pack images. Before calling any API in **ImagePacker**, you must ...@@ -801,7 +802,7 @@ Provide APIs to pack images. Before calling any API in **ImagePacker**, you must
### packing ### packing
packing(source: ImageSource, option: PackingOption, callback: AsyncCallback<Array\<ArrayBuffer>>): void packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<ArrayBuffer>): void
Packs an image. This API uses an asynchronous callback to return the result. Packs an image. This API uses an asynchronous callback to return the result.
...@@ -813,7 +814,7 @@ Packs an image. This API uses an asynchronous callback to return the result. ...@@ -813,7 +814,7 @@ Packs an image. This API uses an asynchronous callback to return the result.
| -------- | ---------------------------------- | ---- | ---------------------------------- | | -------- | ---------------------------------- | ---- | ---------------------------------- |
| source | [ImageSource](#imagesource) | Yes | Image to pack. | | source | [ImageSource](#imagesource) | Yes | Image to pack. |
| option | [PackingOption](#packingoption) | Yes | Option for image packing. | | option | [PackingOption](#packingoption) | Yes | Option for image packing. |
| callback | AsyncCallback<Array\<ArrayBuffer>> | Yes | Callback used to return the packed data.| | callback | AsyncCallback\<ArrayBuffer> | Yes | Callback used to return the packed data.|
**Example** **Example**
...@@ -824,7 +825,7 @@ imagePackerApi.packing(imageSourceApi, packOpts, data => {}) ...@@ -824,7 +825,7 @@ imagePackerApi.packing(imageSourceApi, packOpts, data => {})
### packing ### packing
packing(source: ImageSource, option: PackingOption): Promise<Array\<ArrayBuffer>> packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
Packs an image. This API uses a promise to return the result. Packs an image. This API uses a promise to return the result.
...@@ -841,7 +842,7 @@ Packs an image. This API uses a promise to return the result. ...@@ -841,7 +842,7 @@ Packs an image. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| :--------------------------- | :-------------------------------------------- | | :--------------------------- | :-------------------------------------------- |
| Promise<Array\<ArrayBuffer>> | Promise used to return the packed data.| | Promise\<ArrayBuffer> | Promise used to return the packed data.|
**Example** **Example**
...@@ -852,7 +853,7 @@ imagePackerApi.packing(imageSourceApi, packOpts) ...@@ -852,7 +853,7 @@ imagePackerApi.packing(imageSourceApi, packOpts)
.catch(error => {}) .catch(error => {})
``` ```
### packing ### packing<sup>8+</sup>
packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayBuffer>): void packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayBuffer>): void
...@@ -875,9 +876,9 @@ let packOpts = { format:["image/jpeg"], quality:98 } ...@@ -875,9 +876,9 @@ let packOpts = { format:["image/jpeg"], quality:98 }
imagePackerApi.packing(pixelMapApi, packOpts, data => {}) imagePackerApi.packing(pixelMapApi, packOpts, data => {})
``` ```
### packing ### packing<sup>8+</sup>
packing(source: PixelMap, option: PackingOption): Promise<Array\<ArrayBuffer>> packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
Packs an image. This API uses a promise to return the result. Packs an image. This API uses a promise to return the result.
...@@ -894,7 +895,7 @@ Packs an image. This API uses a promise to return the result. ...@@ -894,7 +895,7 @@ Packs an image. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| :--------------------------- | :-------------------------------------------- | | :--------------------------- | :-------------------------------------------- |
| Promise<Array\<ArrayBuffer>> | Promise used to return the packed data.| | Promise\<ArrayBuffer> | Promise used to return the packed data.|
**Example** **Example**
...@@ -957,7 +958,7 @@ Describes area information in an image. ...@@ -957,7 +958,7 @@ Describes area information in an image.
| pixels | ArrayBuffer | Yes | No | Pixels of the image. | | pixels | ArrayBuffer | Yes | No | Pixels of the image. |
| offset | number | Yes | No | Offset for data reading. | | offset | number | Yes | No | Offset for data reading. |
| stride | number | Yes | No | Number of bytes from one row of pixels in memory to the next row of pixels in memory. The value of **stride** must be greater than or equal to the value of **region.size.width** multiplied by 4. | | stride | number | Yes | No | Number of bytes from one row of pixels in memory to the next row of pixels in memory. The value of **stride** must be greater than or equal to the value of **region.size.width** multiplied by 4. |
| region | [Region](#region8) | Yes | No | Region to read or write. The width of the region to write plus the X coordinate cannot be greater than the width of the original image. The height of the region to write plus the Y coordinate cannot be greater than the height of the original image.| | region | [Region](#region7) | Yes | No | Region to read or write. The width of the region to write plus the X coordinate cannot be greater than the width of the original image. The height of the region to write plus the Y coordinate cannot be greater than the height of the original image.|
## ImageInfo ## ImageInfo
...@@ -1013,7 +1014,7 @@ Enumerates scale modes. ...@@ -1013,7 +1014,7 @@ Enumerates scale modes.
| Name | Default Value| Description | | Name | Default Value| Description |
| --------------- | ------ | -------------------------------------------------- | | --------------- | ------ | -------------------------------------------------- |
| CENTER_CROP | 1 | The image is scaled in such a way that it fits the dimensions of the target and centered in the target. | | CENTER_CROP | 1 | The image is scaled in such a way that it fits the dimensions of the target and centered in the target.|
| FIT_TARGET_SIZE | 2 | The image size is reduced to fit the dimensions of the target. | | FIT_TARGET_SIZE | 2 | The image size is reduced to fit the dimensions of the target. |
## InitializationOptions<sup>8+</sup> ## InitializationOptions<sup>8+</sup>
......
# Media Library Management # Media Library Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -28,6 +28,7 @@ Obtains a **MediaLibrary** instance, which is used to access and modify personal ...@@ -28,6 +28,7 @@ Obtains a **MediaLibrary** instance, which is used to access and modify personal
| ----------------------------- | :---- | | ----------------------------- | :---- |
| [MediaLibrary](#medialibrary) | **MediaLibrary** instance.| | [MediaLibrary](#medialibrary) | **MediaLibrary** instance.|
**Example** **Example**
``` ```
...@@ -246,7 +247,7 @@ Creates a media asset. This API uses a promise to return the result. ...@@ -246,7 +247,7 @@ Creates a media asset. This API uses a promise to return the result.
``` ```
async function example() { async function example() {
// Create an image file in promise mode // Create an image file in promise mode.
let mediaType = mediaLibrary.MediaType.IMAGE; let mediaType = mediaLibrary.MediaType.IMAGE;
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE;
const path = await media.getPublicDirectory(DIR_IMAGE); const path = await media.getPublicDirectory(DIR_IMAGE);
...@@ -437,13 +438,13 @@ var media = mediaLibrary.getMediaLibrary(context); ...@@ -437,13 +438,13 @@ var media = mediaLibrary.getMediaLibrary(context);
media.release() media.release()
``` ```
### storeMediaAsset ### storeMediaAsset<sup>(deprecated)</sup>
storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback&lt;string&gt;): void storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback&lt;string&gt;): void
Stores a media asset. This API uses an asynchronous callback to return the URI that stores the media asset. Stores a media asset. This API uses an asynchronous callback to return the URI that stores the media asset.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -467,19 +468,19 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => { ...@@ -467,19 +468,19 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => {
console.log("An error occurred when storing the media asset."); console.log("An error occurred when storing the media asset.");
return; return;
} }
console.log("Media asset stored. "); console.log("Media asset stored.");
// Obtain the URI that stores the media asset. // Obtain the URI that stores the media asset.
}); });
``` ```
### storeMediaAsset ### storeMediaAsset<sup>(deprecated)</sup>
storeMediaAsset(option: MediaAssetOption): Promise&lt;string&gt; storeMediaAsset(option: MediaAssetOption): Promise&lt;string&gt;
Stores a media asset. This API uses a promise to return the URI that stores the media asset. Stores a media asset. This API uses a promise to return the URI that stores the media asset.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -512,13 +513,13 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => { ...@@ -512,13 +513,13 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => {
``` ```
### startImagePreview ### startImagePreview<sup>(deprecated)</sup>
startImagePreview(images: Array&lt;string&gt;, index: number, callback: AsyncCallback&lt;void&gt;): void startImagePreview(images: Array&lt;string&gt;, index: number, callback: AsyncCallback&lt;void&gt;): void
Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with **dataability://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the execution result. Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with **dataability://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the execution result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -526,7 +527,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a ...@@ -526,7 +527,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- | | -------- | ------------------------- | ---- | ---------------------------------------- |
| images | Array&lt;string&gt; | Yes | URIs of the images to preview. The value can start with either **https://** or **dataability://**.| | images | Array&lt;string&gt; | Yes | URIs of the images to preview. The value can start with either **dataability://** or **https://**.|
| index | number | Yes | Index of the first image to preview. | | index | number | Yes | Index of the first image to preview. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the image preview result. If the preview fails, an error message is returned. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the image preview result. If the preview fails, an error message is returned. |
...@@ -537,7 +538,7 @@ let images = [ ...@@ -537,7 +538,7 @@ let images = [
"dataability:///media/xxxx/2", "dataability:///media/xxxx/2",
"dataability:///media/xxxx/3" "dataability:///media/xxxx/3"
]; ];
/* Online image usage mode /* Preview online images.
let images = [ let images = [
"https://media.xxxx.com/image1.jpg", "https://media.xxxx.com/image1.jpg",
"https://media.xxxx.com/image2.jpg" "https://media.xxxx.com/image2.jpg"
...@@ -554,13 +555,13 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index, (err) => { ...@@ -554,13 +555,13 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index, (err) => {
``` ```
### startImagePreview ### startImagePreview<sup>(deprecated)</sup>
startImagePreview(images: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void startImagePreview(images: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
Starts image preview. This API can be used to preview local images whose URIs start with **dataability://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the execution result. Starts image preview. This API can be used to preview local images whose URIs start with **dataability://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the execution result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -578,7 +579,7 @@ let images = [ ...@@ -578,7 +579,7 @@ let images = [
"dataability:///media/xxxx/2", "dataability:///media/xxxx/2",
"dataability:///media/xxxx/3" "dataability:///media/xxxx/3"
]; ];
/* Online image usage mode /* Preview online images.
let images = [ let images = [
"https://media.xxxx.com/image1.jpg", "https://media.xxxx.com/image1.jpg",
"https://media.xxxx.com/image2.jpg" "https://media.xxxx.com/image2.jpg"
...@@ -594,13 +595,13 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, (err) => { ...@@ -594,13 +595,13 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, (err) => {
``` ```
### startImagePreview ### startImagePreview<sup>(deprecated)</sup>
startImagePreview(images: Array&lt;string&gt;, index?: number): Promise&lt;void&gt; startImagePreview(images: Array&lt;string&gt;, index?: number): Promise&lt;void&gt;
Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with dataability:// or online images whose URIs start with https://. It uses a promise to return the execution result. Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with dataability:// or online images whose URIs start with https://. It uses a promise to return the execution result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -608,7 +609,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a ...@@ -608,7 +609,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------------------- | ---- | ---------------------------------------- | | ------ | ------------------- | ---- | ---------------------------------------- |
| images | Array&lt;string&gt; | Yes | URIs of the images to preview. The value can start with either **https://** or **dataability://**.| | images | Array&lt;string&gt; | Yes | URIs of the images to preview. The value can start with either **dataability://** or **https://**.|
| index | number | No | Index of the first image to preview. If this parameter is not specified, the default value **0** is used. | | index | number | No | Index of the first image to preview. If this parameter is not specified, the default value **0** is used. |
**Return value** **Return value**
...@@ -624,7 +625,7 @@ let images = [ ...@@ -624,7 +625,7 @@ let images = [
"dataability:///media/xxxx/2", "dataability:///media/xxxx/2",
"dataability:///media/xxxx/3" "dataability:///media/xxxx/3"
]; ];
/* Online image usage mode /* Preview online images.
let images = [ let images = [
"https://media.xxxx.com/image1.jpg", "https://media.xxxx.com/image1.jpg",
"https://media.xxxx.com/image2.jpg" "https://media.xxxx.com/image2.jpg"
...@@ -639,13 +640,13 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => { ...@@ -639,13 +640,13 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => {
``` ```
### startMediaSelect ### startMediaSelect<sup>(deprecated)</sup>
startMediaSelect(option: MediaSelectOption, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void startMediaSelect(option: MediaSelectOption, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Starts media selection. This API uses an asynchronous callback to return the list of URIs that store the selected media assets. Starts media selection. This API uses an asynchronous callback to return the list of URIs that store the selected media assets.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -674,13 +675,13 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option, (err, value) => { ...@@ -674,13 +675,13 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option, (err, value) => {
``` ```
### startMediaSelect ### startMediaSelect<sup>(deprecated)</sup>
startMediaSelect(option: MediaSelectOption): Promise&lt;Array&lt;string&gt;&gt; startMediaSelect(option: MediaSelectOption): Promise&lt;Array&lt;string&gt;&gt;
Starts media selection. This API uses a promise to return the list of URIs that store the selected media assets. Starts media selection. This API uses a promise to return the list of URIs that store the selected media assets.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -720,10 +721,10 @@ Provides APIs for encapsulating file asset attributes. ...@@ -720,10 +721,10 @@ Provides APIs for encapsulating file asset attributes.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
| ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ | | ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ |
| id | number | Yes | No | File asset ID. | | id | number | Yes | No | File asset ID. |
| uri | string | Yes | No | File asset URI, for example, dataability:///media/image/2. | | uri | string | Yes | No | File asset URI, for example, **dataability:///media/image/2**. |
| mimeType | string | Yes | No | Extended file attributes. | | mimeType | string | Yes | No | Extended file attributes. |
| mediaType<sup>8+</sup> | [MediaType](#mediatype8) | Yes | No | Media type. | | mediaType<sup>8+</sup> | [MediaType](#mediatype8) | Yes | No | Media type. |
| displayName | string | Yes | Yes | Display file name, including the file name extension. | | displayName | string | Yes | Yes | Display file name, including the file name extension. |
...@@ -738,7 +739,7 @@ Provides APIs for encapsulating file asset attributes. ...@@ -738,7 +739,7 @@ Provides APIs for encapsulating file asset attributes.
| audioAlbum<sup>8+</sup> | string | Yes | No | Audio album. | | audioAlbum<sup>8+</sup> | string | Yes | No | Audio album. |
| width | number | Yes | No | Image width, in pixels. | | width | number | Yes | No | Image width, in pixels. |
| height | number | Yes | No | Image height, in pixels. | | height | number | Yes | No | Image height, in pixels. |
| orientation | number | Yes | Yes | Image display direction (clockwise rotation angle, for example, 0, 90, or 180, in degrees). | | orientation | number | Yes | Yes | Image display direction (clockwise rotation angle, for example, 0, 90, or 180, in degrees).|
| duration<sup>8+</sup> | number | Yes | No | Duration, in seconds. | | duration<sup>8+</sup> | number | Yes | No | Duration, in seconds. |
| albumId | number | Yes | No | ID of the album to which the file belongs. | | albumId | number | Yes | No | ID of the album to which the file belongs. |
| albumUri<sup>8+</sup> | string | Yes | No | URI of the album to which the file belongs. | | albumUri<sup>8+</sup> | string | Yes | No | URI of the album to which the file belongs. |
...@@ -757,9 +758,9 @@ Checks whether this file asset is a directory. This API uses an asynchronous cal ...@@ -757,9 +758,9 @@ Checks whether this file asset is a directory. This API uses an asynchronous cal
**Parameters** **Parameters**
| Parameter | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ------------------- | | -------- | ---------------------------- | ---- | ------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the file asset is a directory. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the file asset is a directory.|
**Example** **Example**
...@@ -821,7 +822,7 @@ async function example() { ...@@ -821,7 +822,7 @@ async function example() {
commitModify(callback: AsyncCallback&lt;void&gt;): void commitModify(callback: AsyncCallback&lt;void&gt;): void
Commits the modification of this file asset to the database. This API uses an asynchronous callback to return the result. Commits the modification in this file asset to the database. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA **Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
...@@ -857,7 +858,7 @@ async function example() { ...@@ -857,7 +858,7 @@ async function example() {
commitModify(): Promise&lt;void&gt; commitModify(): Promise&lt;void&gt;
Commits the modification of this file asset to the database. This API uses a promise to return the result. Commits the modification in this file asset to the database. This API uses a promise to return the result.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA **Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
...@@ -901,7 +902,7 @@ Opens this file asset. This API uses an asynchronous callback to return the resu ...@@ -901,7 +902,7 @@ Opens this file asset. This API uses an asynchronous callback to return the resu
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ----------------------------------- | | -------- | --------------------------- | ---- | ----------------------------------- |
| mode | string | Yes | Mode of opening the file, for example, **r** (read-only), **w** (write-only), and **rw** (read-write).| | mode | string | Yes | Mode of opening the file, for example, **'r'** (read-only), **'w'** (write-only), and **'rw'** (read-write).|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the file handle. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the file handle. |
**Example** **Example**
...@@ -1009,7 +1010,7 @@ close(fd: number): Promise&lt;void&gt; ...@@ -1009,7 +1010,7 @@ close(fd: number): Promise&lt;void&gt;
Closes this file asset. This API uses a promise to return the result. Closes this file asset. This API uses a promise to return the result.
**Required permissions**: ohos.permission.READ_MEDIA (when **mode** is set to **r**) and ohos.permission.WRITE_MEDIA (when **mode** is set to **w**) **Required permissions**: ohos.permission.READ_MEDIA (when **mode** is set to **'r'**) and ohos.permission.WRITE_MEDIA (when **mode** is set to **'w'**)
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -1531,7 +1532,7 @@ Checks whether the cursor is in the last row of the result set. ...@@ -1531,7 +1532,7 @@ Checks whether the cursor is in the last row of the result set.
| Type | Description | | Type | Description |
| ------- | ---------------------------------- | | ------- | ---------------------------------- |
| boolean | Returns **true** if the cursor is in the last row of the result set; returns *false** otherwise.| | boolean | Returns **true** if the cursor is in the last row of the result set; returns *false* otherwise.|
**Example** **Example**
...@@ -1566,7 +1567,7 @@ async function example() { ...@@ -1566,7 +1567,7 @@ async function example() {
close(): void close(): void
Releases and invalidates this **FetchFileResult** instance. Other APIs cannot be invoked after the instance is released. Releases and invalidates this **FetchFileResult** instance. Other APIs in this instance cannot be invoked after it is released.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
...@@ -1965,7 +1966,7 @@ Provides APIs to implement a physical album. ...@@ -1965,7 +1966,7 @@ Provides APIs to implement a physical album.
commitModify(callback: AsyncCallback&lt;void&gt;): void commitModify(callback: AsyncCallback&lt;void&gt;): void
Commits the modification of the album attributes to the database. This API uses an asynchronous callback to return the result. Commits the modification in the album attributes to the database. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA **Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
...@@ -2002,7 +2003,7 @@ async function example() { ...@@ -2002,7 +2003,7 @@ async function example() {
commitModify(): Promise&lt;void&gt; commitModify(): Promise&lt;void&gt;
Commits the modification of the album attributes to the database. This API uses a promise to return the result. Commits the modification in the album attributes to the database. This API uses a promise to return the result.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA **Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
...@@ -2204,7 +2205,7 @@ Describes options for fetching media files. ...@@ -2204,7 +2205,7 @@ Describes options for fetching media files.
| ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ | | ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ |
| selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) 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](#filekey8) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?',|
| selectionArgs | Array&lt;string&gt; | 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&lt;string&gt; | 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<sup>8+</sup> | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) 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](#filekey8) 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"|
| uri<sup>8+</sup> | string | Yes | Yes | No | File URI. | | uri<sup>8+</sup> | string | Yes | Yes | No | File URI. |
| networkId<sup>8+</sup> | string | Yes | Yes | No | Network ID of the registered device. | | networkId<sup>8+</sup> | string | Yes | Yes | No | Network ID of the registered device. |
| extendArgs<sup>8+</sup> | string | Yes | Yes | No | Extended parameters for fetching the files. Currently, no extended parameters are available. | | extendArgs<sup>8+</sup> | string | Yes | Yes | No | Extended parameters for fetching the files. Currently, no extended parameters are available. |
...@@ -2218,30 +2219,30 @@ Describes the image size. ...@@ -2218,30 +2219,30 @@ Describes the image size.
| width | number | Yes | Yes | Image width, in pixels.| | width | number | Yes | Yes | Image width, in pixels.|
| height | number | Yes | Yes | Image height, in pixels.| | height | number | Yes | Yes | Image height, in pixels.|
## MediaAssetOption ## MediaAssetOption<sup>(deprecated)</sup>
Implements the media asset option. Implements the media asset option.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ------------ | ------ | ---- | ---------------------------------------- | | ------------ | ------ | ---- | ------------------------------------------------------------ |
| src | string | Yes | Absolute path of the local file of the application. | | src | string | Yes | Application sandbox oath of the local file. |
| mimeType | string | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.<br>The value can be 'image/\*', 'video/\*', 'audio/\*' or 'file\*'.| | mimeType | string | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.<br>The value can be 'image/\*', 'video/\*', 'audio/\*' or 'file\*'.|
| relativePath | string | No | Custom path for storing media assets, for example, 'Pictures/'. If this parameter is unspecified, media assets are stored in the default path.<br> Default path of images: 'Pictures/'<br> Default path of videos: 'Videos/'<br> Default path of audios: 'Audios/'<br> Default path of files: 'Documents/'| | relativePath | string | No | Custom path for storing media assets, for example, 'Pictures/'. If this parameter is unspecified, media assets are stored in the default path.<br> Default path of images: 'Pictures/'<br> Default path of videos: 'Videos/'<br> Default path of audios: 'Audios/'<br> Default path of files: 'Documents/'|
## MediaSelectOption ## MediaSelectOption<sup>(deprecated)</sup>
Describes media selection option. Describes media selection option.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. > **NOTE**<br>This API is deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core **System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | -------------------- | | ----- | ------ | ---- | -------------------- |
| type | string | Yes | Media type, which can be **image**, **media**, or **video**. Currently, only **media** is supported.| | type | string | Yes | Media type, which can be **image**, **media**, or **video**. Currently, only **media** is supported.|
| count | number | Yes | Number of media assets selected. If **count** is set to **1**, one media asset can be selected. If **count** is greater than **1**, multiple media assets can be selected. | | count | number | Yes | Number of media assets selected. The value starts from 1, which indicates that one media asset can be selected. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册