diff --git a/en/application-dev/reference/apis/js-apis-image.md b/en/application-dev/reference/apis/js-apis-image.md
index 6ac852d368827f8f938d50f49f79c1189b31a5fe..30ead3b023cbb8bf673f948a549e8867f381cb01 100644
--- a/en/application-dev/reference/apis/js-apis-image.md
+++ b/en/application-dev/reference/apis/js-apis-image.md
@@ -1,5 +1,7 @@
# Image Processing
+The **Image** module provides APIs for image processing. You can use the APIs to create a **PixelMap** object with specified properties or read image pixel data (even in an area).
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -35,7 +37,7 @@ Creates a **PixelMap** object. This API uses a promise to return the result.
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts)
.then((pixelmap) => {
@@ -62,7 +64,7 @@ Creates a **PixelMap** object. This API uses an asynchronous callback to return
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (pixelmap) => {
})
@@ -78,7 +80,7 @@ Provides APIs to read or write image pixel map data and obtain image pixel map i
| Name | Type | Readable| Writable| Description |
| ---------- | ------- | ---- | ---- | -------------------------- |
-| isEditable7+ | boolean | Yes | No | Whether the image pixel map is editable.|
+| isEditable | boolean | Yes | No | Whether the image pixel map is editable.|
### readPixelsToBuffer7+
@@ -92,7 +94,7 @@ Reads image pixel map data and writes the data to an **ArrayBuffer**. This API u
| Name| Type | Mandatory| Description |
| ------ | ----------- | ---- | ----------------------------------------------------------------------------------------------------- |
-| dst | ArrayBuffer | Yes | Buffer to which the image pixel map data will be written. |
+| dst | ArrayBuffer | Yes | Buffer to which the image pixel map data will be written. The buffer size is obtained by calling **getPixelBytesNumber**.|
**Return value**
@@ -123,7 +125,7 @@ Reads image pixel map data and writes the data to an **ArrayBuffer**. This API u
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ----------------------------------------------------------------------------------------------------- |
-| dst | ArrayBuffer | Yes | Buffer to which the image pixel map data will be written.|
+| dst | ArrayBuffer | Yes | Buffer to which the image pixel map data will be written. The buffer size is obtained by calling **getPixelBytesNumber**.|
| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned. |
**Example**
@@ -189,7 +191,7 @@ Reads image pixel map data in an area. This API uses an asynchronous callback to
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (err, pixelmap) => {
if(pixelmap == undefined){
@@ -230,7 +232,7 @@ Writes image pixel map data to an area. This API uses a promise to return the op
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts)
.then( pixelmap => {
@@ -318,7 +320,7 @@ Reads image data in an **ArrayBuffer** and writes the data to a **PixelMap** obj
```js
const color = new ArrayBuffer(96);
const pixelMap = new ArrayBuffer(400);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
pixelMap.writeBufferToPixels(color).then(() => {
console.log("Succeeded in writing data from a buffer to a PixelMap.");
}).catch((err) => {
@@ -346,7 +348,7 @@ Reads image data in an **ArrayBuffer** and writes the data to a **PixelMap** obj
```js
const color = new ArrayBuffer(96);\
const pixelMap = new ArrayBuffer(400);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
pixelMap.writeBufferToPixels(color, function(err) {
if (err) {
console.error("Failed to write data from a buffer to a PixelMap.");
@@ -400,7 +402,7 @@ Obtains pixel map information of this image. This API uses an asynchronous callb
```js
pixelmap.getImageInfo((imageInfo) => {
- console.log("Succeeded in obtaining the image pixel map information..");
+ console.log("Succeeded in obtaining the image pixel map information.");
})
```
@@ -422,7 +424,7 @@ Obtains the number of bytes per row of this image pixel map.
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (err,pixelmap) => {
let rowCount = pixelmap.getBytesNumberPerRow();
@@ -467,7 +469,7 @@ Releases this **PixelMap** object. This API uses a promise to return the result.
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (pixelmap) => {
pixelmap.release().then(() => {
@@ -496,7 +498,7 @@ Releases this **PixelMap** object. This API uses an asynchronous callback to ret
```js
const color = new ArrayBuffer(96);
-let bufferArr = new Unit8Array(color);
+let bufferArr = new Uint8Array(color);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (pixelmap) => {
pixelmap.release().then(() => {
@@ -1010,7 +1012,7 @@ imagePackerApi.packing(pixelMapApi, packOpts)
.then( data => {
console.log('Succeeded in packing the image.');
}).catch(error => {
- console.log('Failed to pack the image..');
+ console.log('Failed to pack the image.');
})
```
@@ -1117,7 +1119,7 @@ Defines pixel map initialization options.
| Name | Type | Readable| Writable| Description |
| ------------------------ | ---------------------------------- | ---- | ---- | -------------- |
-| alphaType9+ | [AlphaType](#alphatype9) | Yes | Yes | Alpha type. |
+| editable | boolean | Yes | Yes | Whether the image is editable. |
| pixelFormat | [PixelMapFormat](#pixelmapformat7) | Yes | Yes | Pixel map format. |
| size | [Size](#size) | Yes | Yes | Image size.|
@@ -1173,7 +1175,7 @@ Describes image properties.
## PropertyKey7+
-Describes the exchangeable image file format (Exif) information of an image.
+Describes the exchangeable image file format (EXIF) information of an image.
**System capability**: SystemCapability.Multimedia.Image.Core
@@ -1213,7 +1215,7 @@ Enumerates the response codes returned upon build errors.
| ERR_IMAGE_CROP | 62980109 | An error occurs during image cropping. |
| ERR_IMAGE_SOURCE_DATA | 62980110 | The image source data is incorrect. |
| ERR_IMAGE_SOURCE_DATA_INCOMPLETE | 62980111 | The image source data is incomplete. |
-| ERR_IMAGE_MISMATCHED_FORMAT | 62980112 | The image format does not match. |
+| ERR_IMAGE_MISMATCHED_FORMAT | 62980112 | The image formats do not match. |
| ERR_IMAGE_UNKNOWN_FORMAT | 62980113 | Unknown image format. |
| ERR_IMAGE_SOURCE_UNRESOLVED | 62980114 | The image source is not parsed. |
| ERR_IMAGE_INVALID_PARAMETER | 62980115 | Invalid image parameter. |
@@ -1229,4 +1231,4 @@ Enumerates the response codes returned upon build errors.
| ERR_IMAGE_READ_PIXELMAP_FAILED | 62980246 | Failed to read the pixel map. |
| ERR_IMAGE_WRITE_PIXELMAP_FAILED | 62980247 | Failed to write the pixel map. |
| ERR_IMAGE_PIXELMAP_NOT_ALLOW_MODIFY | 62980248 | Modification to the pixel map is not allowed. |
-| ERR_IMAGE_CONFIG_FAILED | 62980259 | The software parameter setting is incorrect. |
+| ERR_IMAGE_CONFIG_FAILED | 62980259 | The configuration is incorrect. |
diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md
index 896d2a51bf31d8c0cddaecbfb08ac2f82b93cf5c..47d85b0421993ec7a1b31dbd9374409c7c4c37fb 100644
--- a/en/application-dev/reference/apis/js-apis-media.md
+++ b/en/application-dev/reference/apis/js-apis-media.md
@@ -4,6 +4,7 @@
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and use media resources.
This subsystem offers various media services covering audio and video, which provide the following capabilities:
@@ -105,6 +106,7 @@ media.createVideoPlayer().then((video) => {
createAudioRecorder(): AudioRecorder
Creates an **AudioRecorder** instance to control audio recording.
+Only one **AudioRecorder** instance can be created for a device.
**System capability**: SystemCapability.Multimedia.Media.AudioRecorder
@@ -214,7 +216,7 @@ For details about the audio playback demo, see [Audio Playback Development](../.
| Name | Type | Readable| Writable| Description |
| ----------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
-| src | string | Yes | Yes | Audio media URI. The mainstream audio formats (MPEG-4, AAC, MPEG-3, OGG, and WAV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx

2. HTTP network playback: http://xx
3. HLS network playback: under development
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly. |
+| src | string | Yes | Yes | Audio media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx

2. HTTP network playback: http://xx
3. HTTPS network playback: https://xx
4. HLS network playback: http://xx or https://xx
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.|
| loop | boolean | Yes | Yes | Whether to loop audio playback. The value **true** means to loop audio playback, and **false** means the opposite. |
| currentTime | number | Yes | No | Current audio playback position. |
| duration | number | Yes | No | Audio duration. |
@@ -606,7 +608,7 @@ For details about the video playback demo, see [Video Playback Development](../.
| Name | Type | Readable| Writable| Description |
| ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ |
-| url8+ | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx

2. HTTP network playback: http://xx
3. HLS network playback: under development
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly. |
+| url8+ | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx

2. HTTP network playback: http://xx
3. HTTPS network playback: https://xx
4. HLS network playback: http://xx or https://xx
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.|
| loop8+ | boolean | Yes | Yes | Whether to loop video playback. The value **true** means to loop video playback, and **false** means the opposite. |
| currentTime8+ | number | Yes | No | Current video playback position. |
| duration8+ | number | Yes | No | Video duration. The value **-1** indicates the live streaming mode. |
@@ -1604,7 +1606,7 @@ Subscribes to the audio recording events.
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Event type. The following events are supported: 'prepare'\|'start'\| 'pause' \| 'resume' \|'stop'\|'release'\|'reset'
- The 'prepare' event is triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.
- The 'start' event is triggered when the [start](#audiorecorder_start) API is called and audio recording starts.
- The 'pause' event is triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.
- The 'resume' event is triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.
- The 'stop' event is triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.
- The 'release' event is triggered when the [release](#audiorecorder_release) API is called and the recording resource is released.
- The 'reset' event is triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset.|
+| type | string | Yes | Event type. The following events are supported:
- 'prepare': triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.
- 'start': triggered when the [start](#audiorecorder_start) API is called and audio recording starts.
- 'pause': triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.
- 'resume': triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.
- 'stop': triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.
- 'release': triggered when the [release](#audiorecorder_release) API is called and the recording resource is released.
- 'reset': triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset. |
| callback | ()=>void | Yes | Callback invoked when the event is triggered. |
**Example**
@@ -1620,34 +1622,34 @@ let audioRecorderConfig = {
uri : 'fd://xx', // The file must be created by the caller and granted with proper permissions.
location : { latitude : 30, longitude : 130},
}
-audioRecorder.on('error', (error) => { // Set the error event callback.
+audioRecorder.on('error', (error) => { // Set the 'error' event callback.
console.info(`audio error called, errName is ${error.name}`);
console.info(`audio error called, errCode is ${error.code}`);
console.info(`audio error called, errMessage is ${error.message}`);
});
-audioRecorder.on('prepare', () => { // Set the prepare event callback.
+audioRecorder.on('prepare', () => { // Set the 'prepare' event callback.
console.log('prepare success');
- audioRecorder.start(); // Start recording and trigger the start event callback.
+ audioRecorder.start(); // Start recording and trigger the 'start' event callback.
});
-audioRecorder.on('start', () => { // Set the start event callback.
+audioRecorder.on('start', () => { // Set the 'start' event callback.
console.log('audio recorder start success');
});
-audioRecorder.on('pause', () => { // Set the pause event callback.
+audioRecorder.on('pause', () => { // Set the 'pause' event callback.
console.log('audio recorder pause success');
});
-audioRecorder.on('resume', () => { // Set the resume event callback.
+audioRecorder.on('resume', () => { // Set the 'resume' event callback.
console.log('audio recorder resume success');
});
-audioRecorder.on('stop', () => { // Set the stop event callback.
+audioRecorder.on('stop', () => { // Set the 'stop' event callback.
console.log('audio recorder stop success');
});
-audioRecorder.on('release', () => { // Set the release event callback.
+audioRecorder.on('release', () => { // Set the 'release' event callback.
console.log('audio recorder release success');
});
-audioRecorder.on('reset', () => { // Set the reset event callback.
+audioRecorder.on('reset', () => { // Set the 'reset' event callback.
console.log('audio recorder reset success');
});
-audioRecorder.prepare(audioRecorderConfig) // Set recording parameters and trigger the prepare event callback.
+audioRecorder.prepare(audioRecorderConfig) // Set recording parameters and trigger the 'prepare' event callback.
```
### on('error')
@@ -1668,12 +1670,12 @@ Subscribes to the audio recording error event.
**Example**
```js
-audioRecorder.on('error', (error) => { // Set the error event callback.
+audioRecorder.on('error', (error) => { // Set the 'error' event callback.
console.info(`audio error called, errName is ${error.name}`); // Print the error name.
console.info(`audio error called, errCode is ${error.code}`); // Print the error code.
console.info(`audio error called, errMessage is ${error.message}`); // Print the detailed description of the error type.
});
-audioRecorder.prepare(); // Do no set any parameter in prepare and trigger the error event callback.
+audioRecorder.prepare(); // Do no set any parameter in prepare and trigger the 'error' event callback.
```
## AudioRecorderConfig
@@ -1690,7 +1692,7 @@ Describes audio recording configurations.
| numberOfChannels | number | No | Number of audio channels. The default value is **2**. |
| format(deprecated) | [AudioOutputFormat](#audiooutputformat) | No | Audio output format. The default value is **MPEG_4**.
**Note**: This parameter is deprecated since API version 8. Use **fileFormat** instead. |
| location | [Location](#location) | No | Geographical location of the recorded audio. |
-| uri | string | Yes | Audio output URI. Supported: fd://xx (fd number)

The file must be created by the caller and granted with proper permissions.|
+| uri | string | Yes | Audio output URI. Supported: fd://xx (fd number)

The file must be created by the caller and granted with proper permissions.|
| audioEncoderMime8+ | [CodecMimeType](#codecmimetype8) | No | Audio encoding format. |
| fileFormat8+ | [ContainerFormatType](#containerformattype8) | No | Audio encoding format. |