提交 6e5dff3c 编写于 作者: G Gloria

Update docs against 18010+18305

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 f4fd2557
...@@ -3553,6 +3553,7 @@ let inputAudioDeviceDescriptor = [{ ...@@ -3553,6 +3553,7 @@ let inputAudioDeviceDescriptor = [{
networkId : audio.LOCAL_NETWORK_ID, networkId : audio.LOCAL_NETWORK_ID,
interruptGroupId : 1, interruptGroupId : 1,
volumeGroupId : 1, volumeGroupId : 1,
displayName : "",
}]; }];
async function selectInputDevice(){ async function selectInputDevice(){
...@@ -3602,6 +3603,7 @@ let inputAudioDeviceDescriptor = [{ ...@@ -3602,6 +3603,7 @@ let inputAudioDeviceDescriptor = [{
networkId : audio.LOCAL_NETWORK_ID, networkId : audio.LOCAL_NETWORK_ID,
interruptGroupId : 1, interruptGroupId : 1,
volumeGroupId : 1, volumeGroupId : 1,
displayName : "",
}]; }];
async function getRoutingManager(){ async function getRoutingManager(){
...@@ -3756,6 +3758,7 @@ let outputAudioDeviceDescriptor = [{ ...@@ -3756,6 +3758,7 @@ let outputAudioDeviceDescriptor = [{
networkId : audio.LOCAL_NETWORK_ID, networkId : audio.LOCAL_NETWORK_ID,
interruptGroupId : 1, interruptGroupId : 1,
volumeGroupId : 1, volumeGroupId : 1,
displayName : "",
}]; }];
async function selectOutputDevice(){ async function selectOutputDevice(){
...@@ -3805,6 +3808,7 @@ let outputAudioDeviceDescriptor = [{ ...@@ -3805,6 +3808,7 @@ let outputAudioDeviceDescriptor = [{
networkId : audio.LOCAL_NETWORK_ID, networkId : audio.LOCAL_NETWORK_ID,
interruptGroupId : 1, interruptGroupId : 1,
volumeGroupId : 1, volumeGroupId : 1,
displayName : "",
}]; }];
async function selectOutputDevice(){ async function selectOutputDevice(){
...@@ -3856,6 +3860,7 @@ let outputAudioDeviceDescriptor = [{ ...@@ -3856,6 +3860,7 @@ let outputAudioDeviceDescriptor = [{
networkId : audio.LOCAL_NETWORK_ID, networkId : audio.LOCAL_NETWORK_ID,
interruptGroupId : 1, interruptGroupId : 1,
volumeGroupId : 1, volumeGroupId : 1,
displayName : "",
}]; }];
async function selectOutputDeviceByFilter(){ async function selectOutputDeviceByFilter(){
...@@ -3914,6 +3919,7 @@ let outputAudioDeviceDescriptor = [{ ...@@ -3914,6 +3919,7 @@ let outputAudioDeviceDescriptor = [{
networkId : audio.LOCAL_NETWORK_ID, networkId : audio.LOCAL_NETWORK_ID,
interruptGroupId : 1, interruptGroupId : 1,
volumeGroupId : 1, volumeGroupId : 1,
displayName : "",
}]; }];
async function selectOutputDeviceByFilter(){ async function selectOutputDeviceByFilter(){
...@@ -4082,17 +4088,18 @@ Describes the audio renderer change event. ...@@ -4082,17 +4088,18 @@ Describes the audio renderer change event.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
| ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- | | -------------------| ----------------------------------------- | ---- | ---- | ---------------------------- |
| streamId | number | Yes | No | Unique ID of an audio stream. | | streamId | number | Yes | No | Unique ID of an audio stream. |
| clientUid | number | Yes | No | UID of the audio renderer client.<br>This is a system API. | | clientUid | number | Yes | No | UID of the audio renderer client.<br>This is a system API.|
| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. |
| rendererState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API. | | rendererState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API.|
| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. | | deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description.|
**Example** **Example**
```js ```js
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
const audioManager = audio.getAudioManager(); const audioManager = audio.getAudioManager();
...@@ -4140,13 +4147,13 @@ Describes the audio capturer change event. ...@@ -4140,13 +4147,13 @@ Describes the audio capturer change event.
**System capability**: SystemCapability.Multimedia.Audio.Capturer **System capability**: SystemCapability.Multimedia.Audio.Capturer
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
| ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- | | -------------------| ----------------------------------------- | ---- | ---- | ---------------------------- |
| streamId | number | Yes | No | Unique ID of an audio stream. | | streamId | number | Yes | No | Unique ID of an audio stream. |
| clientUid | number | Yes | No | UID of the audio capturer client.<br>This is a system API. | | clientUid | number | Yes | No | UID of the audio capturer client.<br>This is a system API.|
| capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. | | capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. |
| capturerState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API. | | capturerState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API.|
| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. | | deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description.|
**Example** **Example**
...@@ -4194,19 +4201,20 @@ Describes an audio device. ...@@ -4194,19 +4201,20 @@ Describes an audio device.
**System capability**: SystemCapability.Multimedia.Audio.Device **System capability**: SystemCapability.Multimedia.Audio.Device
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
| ----------------------------- | ------------------------- | -------- | -------- | ------------------------------------------------------------ | | ----------------------------- | -------------------------- | ---- | ---- | ---------- |
| deviceRole | [DeviceRole](#devicerole) | Yes | No | Device role. | | deviceRole | [DeviceRole](#devicerole) | Yes | No | Device role.|
| deviceType | [DeviceType](#devicetype) | Yes | No | Device type. | | deviceType | [DeviceType](#devicetype) | Yes | No | Device type.|
| id<sup>9+</sup> | number | Yes | No | Device ID, which is unique. | | id<sup>9+</sup> | number | Yes | No | Device ID, which is unique. |
| name<sup>9+</sup> | string | Yes | No | Device name. | | name<sup>9+</sup> | string | Yes | No | Device name.|
| address<sup>9+</sup> | string | Yes | No | Device address. | | address<sup>9+</sup> | string | Yes | No | Device address.|
| sampleRates<sup>9+</sup> | Array&lt;number&gt; | Yes | No | Supported sampling rates. | | sampleRates<sup>9+</sup> | Array&lt;number&gt; | Yes | No | Supported sampling rates.|
| channelCounts<sup>9+</sup> | Array&lt;number&gt; | Yes | No | Number of channels supported. | | channelCounts<sup>9+</sup> | Array&lt;number&gt; | Yes | No | Number of channels supported.|
| channelMasks<sup>9+</sup> | Array&lt;number&gt; | Yes | No | Supported channel masks. | | channelMasks<sup>9+</sup> | Array&lt;number&gt; | Yes | No | Supported channel masks.|
| networkId<sup>9+</sup> | string | Yes | No | ID of the device network.<br>This is a system API. | | displayName<sup>10+</sup> | string | Yes | No | Display name of the device.|
| interruptGroupId<sup>9+</sup> | number | Yes | No | ID of the interruption group to which the device belongs.<br>This is a system API. | | networkId<sup>9+</sup> | string | Yes | No | ID of the device network.<br>This is a system API.|
| volumeGroupId<sup>9+</sup> | number | Yes | No | ID of the volume group to which the device belongs.<br>This is a system API. | | interruptGroupId<sup>9+</sup> | number | Yes | No | ID of the interruption group to which the device belongs.<br>This is a system API.|
| volumeGroupId<sup>9+</sup> | number | Yes | No | ID of the volume group to which the device belongs.<br>This is a system API.|
**Example** **Example**
...@@ -4238,11 +4246,11 @@ Implements filter criteria. Before calling **selectOutputDeviceByFilter**, you m ...@@ -4238,11 +4246,11 @@ Implements filter criteria. Before calling **selectOutputDeviceByFilter**, you m
**System API**: This is a system API. **System API**: This is a system API.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ------------ | ---------------------------------------- | --------- | ------------------------------------------------------------ | | -------------| ---------------------------------------- | ---- | -------------- |
| uid | number | No | Application ID.<br> **System capability**: SystemCapability.Multimedia.Audio.Core | | uid | number | No | Application ID.<br> **System capability**: SystemCapability.Multimedia.Audio.Core|
| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | No | Audio renderer information.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | No | Audio renderer information.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer|
| rendererId | number | No | Unique ID of an audio stream.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer | | rendererId | number | No | Unique ID of an audio stream.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer|
**Example** **Example**
...@@ -4264,9 +4272,9 @@ Provides APIs for audio rendering. Before calling any API in **AudioRenderer**, ...@@ -4264,9 +4272,9 @@ Provides APIs for audio rendering. Before calling any API in **AudioRenderer**,
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
| ------------------ | -------------------------- | -------- | -------- | --------------------- | | ----- | -------------------------- | ---- | ---- | ------------------ |
| state<sup>8+</sup> | [AudioState](#audiostate8) | Yes | No | Audio renderer state. | | state<sup>8+</sup> | [AudioState](#audiostate8) | Yes | No | Audio renderer state.|
**Example** **Example**
...@@ -4284,9 +4292,9 @@ Obtains the renderer information of this **AudioRenderer** instance. This API us ...@@ -4284,9 +4292,9 @@ Obtains the renderer information of this **AudioRenderer** instance. This API us
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------------------------------------------- | :-------- | :------------------------------------------------ | | :------- | :------------------------------------------------------- | :--- | :--------------------- |
| callback | AsyncCallback<[AudioRendererInfo](#audiorendererinfo8)\> | Yes | Callback used to return the renderer information. | | callback | AsyncCallback<[AudioRendererInfo](#audiorendererinfo8)\> | Yes | Callback used to return the renderer information.|
**Example** **Example**
...@@ -4310,8 +4318,8 @@ Obtains the renderer information of this **AudioRenderer** instance. This API us ...@@ -4310,8 +4318,8 @@ Obtains the renderer information of this **AudioRenderer** instance. This API us
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------------------------------------------- | ------------------------------------------------ | | -------------------------------------------------- | ------------------------------- |
| Promise<[AudioRendererInfo](#audiorendererinfo8)\> | Promise used to return the renderer information. | | Promise<[AudioRendererInfo](#audiorendererinfo8)\> | Promise used to return the renderer information.|
**Example** **Example**
...@@ -4336,9 +4344,9 @@ Obtains the stream information of this **AudioRenderer** instance. This API uses ...@@ -4336,9 +4344,9 @@ Obtains the stream information of this **AudioRenderer** instance. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------------------------------------- | :-------- | :---------------------------------------------- | | :------- | :--------------------------------------------------- | :--- | :------------------- |
| callback | AsyncCallback<[AudioStreamInfo](#audiostreaminfo8)\> | Yes | Callback used to return the stream information. | | callback | AsyncCallback<[AudioStreamInfo](#audiostreaminfo8)\> | Yes | Callback used to return the stream information.|
**Example** **Example**
...@@ -4363,8 +4371,8 @@ Obtains the stream information of this **AudioRenderer** instance. This API uses ...@@ -4363,8 +4371,8 @@ Obtains the stream information of this **AudioRenderer** instance. This API uses
**Return value** **Return value**
| Type | Description | | Type | Description |
| :--------------------------------------------- | :--------------------------------------------- | | :--------------------------------------------- | :--------------------- |
| Promise<[AudioStreamInfo](#audiostreaminfo8)\> | Promise used to return the stream information. | | Promise<[AudioStreamInfo](#audiostreaminfo8)\> | Promise used to return the stream information.|
**Example** **Example**
...@@ -4378,7 +4386,6 @@ audioRenderer.getStreamInfo().then((streamInfo) => { ...@@ -4378,7 +4386,6 @@ audioRenderer.getStreamInfo().then((streamInfo) => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### getAudioStreamId<sup>9+</sup> ### getAudioStreamId<sup>9+</sup>
...@@ -4391,9 +4398,9 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async ...@@ -4391,9 +4398,9 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :------------------------------------- | | :------- | :--------------------------------------------------- | :--- | :------------------- |
| callback | AsyncCallback<number\> | Yes | Callback used to return the stream ID. | | callback | AsyncCallback<number\> | Yes | Callback used to return the stream ID.|
**Example** **Example**
...@@ -4401,7 +4408,6 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async ...@@ -4401,7 +4408,6 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async
audioRenderer.getAudioStreamId((err, streamid) => { audioRenderer.getAudioStreamId((err, streamid) => {
console.info(`Renderer GetStreamId: ${streamid}`); console.info(`Renderer GetStreamId: ${streamid}`);
}); });
``` ```
### getAudioStreamId<sup>9+</sup> ### getAudioStreamId<sup>9+</sup>
...@@ -4415,8 +4421,8 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses a promis ...@@ -4415,8 +4421,8 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses a promis
**Return value** **Return value**
| Type | Description | | Type | Description |
| :--------------- | :------------------------------------ | | :--------------------------------------------- | :--------------------- |
| Promise<number\> | Promise used to return the stream ID. | | Promise<number\> | Promise used to return the stream ID.|
**Example** **Example**
...@@ -4426,7 +4432,6 @@ audioRenderer.getAudioStreamId().then((streamid) => { ...@@ -4426,7 +4432,6 @@ audioRenderer.getAudioStreamId().then((streamid) => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### start<sup>8+</sup> ### start<sup>8+</sup>
...@@ -4439,9 +4444,9 @@ Starts the renderer. This API uses an asynchronous callback to return the result ...@@ -4439,9 +4444,9 @@ Starts the renderer. This API uses an asynchronous callback to return the result
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | --------- | ----------------------------------- | | -------- | -------------------- | ---- | ---------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -4453,7 +4458,6 @@ audioRenderer.start((err) => { ...@@ -4453,7 +4458,6 @@ audioRenderer.start((err) => {
console.info('Renderer start success.'); console.info('Renderer start success.');
} }
}); });
``` ```
### start<sup>8+</sup> ### start<sup>8+</sup>
...@@ -4467,8 +4471,8 @@ Starts the renderer. This API uses a promise to return the result. ...@@ -4467,8 +4471,8 @@ Starts the renderer. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -4478,7 +4482,6 @@ audioRenderer.start().then(() => { ...@@ -4478,7 +4482,6 @@ audioRenderer.start().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### pause<sup>8+</sup> ### pause<sup>8+</sup>
...@@ -4491,9 +4494,9 @@ Pauses rendering. This API uses an asynchronous callback to return the result. ...@@ -4491,9 +4494,9 @@ Pauses rendering. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | --------- | ----------------------------------- | | -------- | -------------------- | ---- | ---------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -4505,7 +4508,6 @@ audioRenderer.pause((err) => { ...@@ -4505,7 +4508,6 @@ audioRenderer.pause((err) => {
console.info('Renderer paused.'); console.info('Renderer paused.');
} }
}); });
``` ```
### pause<sup>8+</sup> ### pause<sup>8+</sup>
...@@ -4519,8 +4521,8 @@ Pauses rendering. This API uses a promise to return the result. ...@@ -4519,8 +4521,8 @@ Pauses rendering. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -4530,7 +4532,6 @@ audioRenderer.pause().then(() => { ...@@ -4530,7 +4532,6 @@ audioRenderer.pause().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### drain<sup>8+</sup> ### drain<sup>8+</sup>
...@@ -4543,9 +4544,9 @@ Drains the playback buffer. This API uses an asynchronous callback to return the ...@@ -4543,9 +4544,9 @@ Drains the playback buffer. This API uses an asynchronous callback to return the
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | --------- | ----------------------------------- | | -------- | -------------------- | ---- | ---------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -4557,7 +4558,6 @@ audioRenderer.drain((err) => { ...@@ -4557,7 +4558,6 @@ audioRenderer.drain((err) => {
console.info('Renderer drained.'); console.info('Renderer drained.');
} }
}); });
``` ```
### drain<sup>8+</sup> ### drain<sup>8+</sup>
...@@ -4571,8 +4571,8 @@ Drains the playback buffer. This API uses a promise to return the result. ...@@ -4571,8 +4571,8 @@ Drains the playback buffer. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -4582,7 +4582,6 @@ audioRenderer.drain().then(() => { ...@@ -4582,7 +4582,6 @@ audioRenderer.drain().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### stop<sup>8+</sup> ### stop<sup>8+</sup>
...@@ -4595,9 +4594,9 @@ Stops rendering. This API uses an asynchronous callback to return the result. ...@@ -4595,9 +4594,9 @@ Stops rendering. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | --------- | ----------------------------------- | | -------- | -------------------- | ---- | ---------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -4609,7 +4608,6 @@ audioRenderer.stop((err) => { ...@@ -4609,7 +4608,6 @@ audioRenderer.stop((err) => {
console.info('Renderer stopped.'); console.info('Renderer stopped.');
} }
}); });
``` ```
### stop<sup>8+</sup> ### stop<sup>8+</sup>
...@@ -4623,8 +4621,8 @@ Stops rendering. This API uses a promise to return the result. ...@@ -4623,8 +4621,8 @@ Stops rendering. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -4634,7 +4632,6 @@ audioRenderer.stop().then(() => { ...@@ -4634,7 +4632,6 @@ audioRenderer.stop().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### release<sup>8+</sup> ### release<sup>8+</sup>
...@@ -4647,9 +4644,9 @@ Releases the renderer. This API uses an asynchronous callback to return the resu ...@@ -4647,9 +4644,9 @@ Releases the renderer. This API uses an asynchronous callback to return the resu
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | --------- | ----------------------------------- | | -------- | -------------------- | ---- | ---------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -4661,7 +4658,6 @@ audioRenderer.release((err) => { ...@@ -4661,7 +4658,6 @@ audioRenderer.release((err) => {
console.info('Renderer released.'); console.info('Renderer released.');
} }
}); });
``` ```
### release<sup>8+</sup> ### release<sup>8+</sup>
...@@ -4675,8 +4671,8 @@ Releases the renderer. This API uses a promise to return the result. ...@@ -4675,8 +4671,8 @@ Releases the renderer. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -4686,7 +4682,6 @@ audioRenderer.release().then(() => { ...@@ -4686,7 +4682,6 @@ audioRenderer.release().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### write<sup>8+</sup> ### write<sup>8+</sup>
...@@ -4699,10 +4694,10 @@ Writes the buffer. This API uses an asynchronous callback to return the result. ...@@ -4699,10 +4694,10 @@ Writes the buffer. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | --------- | ------------------------------------------------------------ | | -------- | ---------------------- | ---- | --------------------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer to be written. | | buffer | ArrayBuffer | Yes | Buffer to be written. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the result. If the operation is successful, the number of bytes written is returned; otherwise, an error code is returned. | | callback | AsyncCallback\<number> | Yes | Callback used to return the result. If the operation is successful, the number of bytes written is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -4742,7 +4737,6 @@ for (let i = 0;i < len; i++) { ...@@ -4742,7 +4737,6 @@ for (let i = 0;i < len; i++) {
}) })
} }
``` ```
### write<sup>8+</sup> ### write<sup>8+</sup>
...@@ -4757,7 +4751,7 @@ Writes the buffer. This API uses a promise to return the result. ...@@ -4757,7 +4751,7 @@ Writes the buffer. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ---------------- | ------------------------------------------------------------ | | ---------------- | ------------------------------------------------------------ |
| Promise\<number> | Promise used to return the result. If the operation is successful, the number of bytes written is returned; otherwise, an error code is returned. | | Promise\<number> | Promise used to return the result. If the operation is successful, the number of bytes written is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -4792,7 +4786,6 @@ for (let i = 0;i < len; i++) { ...@@ -4792,7 +4786,6 @@ for (let i = 0;i < len; i++) {
console.error(`audioRenderer.write err: ${err}`); console.error(`audioRenderer.write err: ${err}`);
} }
} }
``` ```
### getAudioTime<sup>8+</sup> ### getAudioTime<sup>8+</sup>
...@@ -4805,9 +4798,9 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -4805,9 +4798,9 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970).
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | --------- | -------------------------------------- | | -------- | ---------------------- | ---- | ---------------- |
| callback | AsyncCallback\<number> | Yes | Callback used to return the timestamp. | | callback | AsyncCallback\<number> | Yes | Callback used to return the timestamp.|
**Example** **Example**
...@@ -4815,7 +4808,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -4815,7 +4808,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970).
audioRenderer.getAudioTime((err, timestamp) => { audioRenderer.getAudioTime((err, timestamp) => {
console.info(`Current timestamp: ${timestamp}`); console.info(`Current timestamp: ${timestamp}`);
}); });
``` ```
### getAudioTime<sup>8+</sup> ### getAudioTime<sup>8+</sup>
...@@ -4829,8 +4821,8 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -4829,8 +4821,8 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970).
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ------------------------------------- | | ---------------- | ----------------------- |
| Promise\<number> | Promise used to return the timestamp. | | Promise\<number> | Promise used to return the timestamp.|
**Example** **Example**
...@@ -4840,7 +4832,6 @@ audioRenderer.getAudioTime().then((timestamp) => { ...@@ -4840,7 +4832,6 @@ audioRenderer.getAudioTime().then((timestamp) => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### getBufferSize<sup>8+</sup> ### getBufferSize<sup>8+</sup>
...@@ -4853,9 +4844,9 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a ...@@ -4853,9 +4844,9 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | --------- | ---------------------------------------- | | -------- | ---------------------- | ---- | -------------------- |
| callback | AsyncCallback\<number> | Yes | Callback used to return the buffer size. | | callback | AsyncCallback\<number> | Yes | Callback used to return the buffer size.|
**Example** **Example**
...@@ -4865,7 +4856,6 @@ let bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => { ...@@ -4865,7 +4856,6 @@ let bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => {
console.error('getBufferSize error'); console.error('getBufferSize error');
} }
}); });
``` ```
### getBufferSize<sup>8+</sup> ### getBufferSize<sup>8+</sup>
...@@ -4879,8 +4869,8 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a ...@@ -4879,8 +4869,8 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | --------------------------------------- | | ---------------- | --------------------------- |
| Promise\<number> | Promise used to return the buffer size. | | Promise\<number> | Promise used to return the buffer size.|
**Example** **Example**
...@@ -4892,7 +4882,6 @@ audioRenderer.getBufferSize().then((data) => { ...@@ -4892,7 +4882,6 @@ audioRenderer.getBufferSize().then((data) => {
}).catch((err) => { }).catch((err) => {
console.error(`AudioFrameworkRenderLog: getBufferSize: ERROR: ${err}`); console.error(`AudioFrameworkRenderLog: getBufferSize: ERROR: ${err}`);
}); });
``` ```
### setRenderRate<sup>8+</sup> ### setRenderRate<sup>8+</sup>
...@@ -4905,10 +4894,10 @@ Sets the render rate. This API uses an asynchronous callback to return the resul ...@@ -4905,10 +4894,10 @@ Sets the render rate. This API uses an asynchronous callback to return the resul
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | --------- | ----------------------------------- | | -------- | ---------------------------------------- | ---- | ------------------------ |
| rate | [AudioRendererRate](#audiorendererrate8) | Yes | Audio render rate. | | rate | [AudioRendererRate](#audiorendererrate8) | Yes | Audio render rate. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -4920,7 +4909,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL, (err) => ...@@ -4920,7 +4909,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL, (err) =>
console.info('Callback invoked to indicate a successful render rate setting.'); console.info('Callback invoked to indicate a successful render rate setting.');
} }
}); });
``` ```
### setRenderRate<sup>8+</sup> ### setRenderRate<sup>8+</sup>
...@@ -4933,15 +4921,15 @@ Sets the render rate. This API uses a promise to return the result. ...@@ -4933,15 +4921,15 @@ Sets the render rate. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| ---- | ---------------------------------------- | --------- | ------------------ | | ------ | ---------------------------------------- | ---- | ------------ |
| rate | [AudioRendererRate](#audiorendererrate8) | Yes | Audio render rate. | | rate | [AudioRendererRate](#audiorendererrate8) | Yes | Audio render rate.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -4951,7 +4939,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(() ...@@ -4951,7 +4939,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(()
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### getRenderRate<sup>8+</sup> ### getRenderRate<sup>8+</sup>
...@@ -4964,9 +4951,9 @@ Obtains the current render rate. This API uses an asynchronous callback to retur ...@@ -4964,9 +4951,9 @@ Obtains the current render rate. This API uses an asynchronous callback to retur
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | --------- | ---------------------------------------------- | | -------- | ------------------------------------------------------- | ---- | ------------------ |
| callback | AsyncCallback<[AudioRendererRate](#audiorendererrate8)> | Yes | Callback used to return the audio render rate. | | callback | AsyncCallback<[AudioRendererRate](#audiorendererrate8)> | Yes | Callback used to return the audio render rate.|
**Example** **Example**
...@@ -4974,7 +4961,6 @@ Obtains the current render rate. This API uses an asynchronous callback to retur ...@@ -4974,7 +4961,6 @@ Obtains the current render rate. This API uses an asynchronous callback to retur
audioRenderer.getRenderRate((err, renderrate) => { audioRenderer.getRenderRate((err, renderrate) => {
console.info(`getRenderRate: ${renderrate}`); console.info(`getRenderRate: ${renderrate}`);
}); });
``` ```
### getRenderRate<sup>8+</sup> ### getRenderRate<sup>8+</sup>
...@@ -4988,8 +4974,8 @@ Obtains the current render rate. This API uses a promise to return the result. ...@@ -4988,8 +4974,8 @@ Obtains the current render rate. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------- | --------------------------------------------- | | ------------------------------------------------- | ------------------------- |
| Promise<[AudioRendererRate](#audiorendererrate8)> | Promise used to return the audio render rate. | | Promise<[AudioRendererRate](#audiorendererrate8)> | Promise used to return the audio render rate.|
**Example** **Example**
...@@ -4999,9 +4985,7 @@ audioRenderer.getRenderRate().then((renderRate) => { ...@@ -4999,9 +4985,7 @@ audioRenderer.getRenderRate().then((renderRate) => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### setInterruptMode<sup>9+</sup> ### setInterruptMode<sup>9+</sup>
setInterruptMode(mode: InterruptMode): Promise&lt;void&gt; setInterruptMode(mode: InterruptMode): Promise&lt;void&gt;
...@@ -5013,14 +4997,14 @@ Sets the audio interruption mode for the application. This API uses a promise to ...@@ -5013,14 +4997,14 @@ Sets the audio interruption mode for the application. This API uses a promise to
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | -------------------------------- | --------- | ------------------------ | | ---------- | ---------------------------------- | ------ | ---------- |
| mode | [InterruptMode](#interruptmode9) | Yes | Audio interruption mode. | | mode | [InterruptMode](#interruptmode9) | Yes | Audio interruption mode. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------------------------------------------------------ | | ------------------- | ----------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. If the operation is successful, **undefined** is returned. Otherwise, **error** is returned. | | Promise&lt;void&gt; | Promise used to return the result. If the operation is successful, **undefined** is returned. Otherwise, **error** is returned.|
**Example** **Example**
...@@ -5031,9 +5015,7 @@ audioRenderer.setInterruptMode(mode).then(data=>{ ...@@ -5031,9 +5015,7 @@ audioRenderer.setInterruptMode(mode).then(data=>{
}).catch((err) => { }).catch((err) => {
console.error(`setInterruptMode Fail: ${err}`); console.error(`setInterruptMode Fail: ${err}`);
}); });
``` ```
### setInterruptMode<sup>9+</sup> ### setInterruptMode<sup>9+</sup>
setInterruptMode(mode: InterruptMode, callback: AsyncCallback\<void>): void setInterruptMode(mode: InterruptMode, callback: AsyncCallback\<void>): void
...@@ -5045,9 +5027,9 @@ Sets the audio interruption mode for the application. This API uses an asynchron ...@@ -5045,9 +5027,9 @@ Sets the audio interruption mode for the application. This API uses an asynchron
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------- | --------- | ----------------------------------- | | ------- | ----------------------------------- | ------ | -------------- |
| mode | [InterruptMode](#interruptmode9) | Yes | Audio interruption mode. | |mode | [InterruptMode](#interruptmode9) | Yes | Audio interruption mode.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | |callback | AsyncCallback\<void> | Yes |Callback used to return the result.|
**Example** **Example**
...@@ -5059,7 +5041,6 @@ audioRenderer.setInterruptMode(mode, (err, data)=>{ ...@@ -5059,7 +5041,6 @@ audioRenderer.setInterruptMode(mode, (err, data)=>{
} }
console.info('setInterruptMode Success!'); console.info('setInterruptMode Success!');
}); });
``` ```
### setVolume<sup>9+</sup> ### setVolume<sup>9+</sup>
...@@ -5073,14 +5054,14 @@ Sets the volume for the application. This API uses a promise to return the resul ...@@ -5073,14 +5054,14 @@ Sets the volume for the application. This API uses a promise to return the resul
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | --------- | ------------------------------------------------------------ | | ---------- | ------- | ------ | ------------------- |
| volume | number | Yes | Volume to set, which can be within the range from 0.0 to 1.0. | | volume | number | Yes | Volume to set, which can be within the range from 0.0 to 1.0.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------------------------------------------------------ | | ------------------- | ----------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. If the operation is successful, **undefined** is returned. Otherwise, **error** is returned. | | Promise&lt;void&gt; | Promise used to return the result. If the operation is successful, **undefined** is returned. Otherwise, **error** is returned.|
**Example** **Example**
...@@ -5090,9 +5071,7 @@ audioRenderer.setVolume(0.5).then(data=>{ ...@@ -5090,9 +5071,7 @@ audioRenderer.setVolume(0.5).then(data=>{
}).catch((err) => { }).catch((err) => {
console.error(`setVolume Fail: ${err}`); console.error(`setVolume Fail: ${err}`);
}); });
``` ```
### setVolume<sup>9+</sup> ### setVolume<sup>9+</sup>
setVolume(volume: number, callback: AsyncCallback\<void>): void setVolume(volume: number, callback: AsyncCallback\<void>): void
...@@ -5104,9 +5083,9 @@ Sets the volume for the application. This API uses an asynchronous callback to r ...@@ -5104,9 +5083,9 @@ Sets the volume for the application. This API uses an asynchronous callback to r
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | --------- | ------------------------------------------------------------ | | ------- | -----------| ------ | ------------------- |
| volume | number | Yes | Volume to set, which can be within the range from 0.0 to 1.0. | |volume | number | Yes | Volume to set, which can be within the range from 0.0 to 1.0.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | |callback | AsyncCallback\<void> | Yes |Callback used to return the result.|
**Example** **Example**
...@@ -5117,7 +5096,6 @@ audioRenderer.setVolume(0.5, (err, data)=>{ ...@@ -5117,7 +5096,6 @@ audioRenderer.setVolume(0.5, (err, data)=>{
} }
console.info('setVolume Success!'); console.info('setVolume Success!');
}); });
``` ```
### on('audioInterrupt')<sup>9+</sup> ### on('audioInterrupt')<sup>9+</sup>
...@@ -5132,17 +5110,17 @@ Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus ch ...@@ -5132,17 +5110,17 @@ Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus ch
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ | | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio rendering is interrupted. | | type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio rendering is interrupted.|
| callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. | | callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. |
**Error codes** **Error codes**
For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md).
| ID | Error Message | | ID| Error Message|
| ------- | ------------------------------ | | ------- | --------------------------------------------|
| 6800101 | if input parameter value error | | 6800101 | if input parameter value error |
**Example** **Example**
...@@ -5215,7 +5193,6 @@ async function onAudioInterrupt(){ ...@@ -5215,7 +5193,6 @@ async function onAudioInterrupt(){
} }
}); });
} }
``` ```
### on('markReach')<sup>8+</sup> ### on('markReach')<sup>8+</sup>
...@@ -5228,9 +5205,9 @@ Subscribes to mark reached events. When the number of frames rendered reaches th ...@@ -5228,9 +5205,9 @@ Subscribes to mark reached events. When the number of frames rendered reaches th
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------------------------------- | | :------- | :----------------------- | :--- | :---------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'markReach'**. | | type | string | Yes | Event type. The value is fixed at **'markReach'**.|
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. | | frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. |
| callback | Callback\<number> | Yes | Callback invoked when the event is triggered. | | callback | Callback\<number> | Yes | Callback invoked when the event is triggered. |
...@@ -5242,7 +5219,6 @@ audioRenderer.on('markReach', 1000, (position) => { ...@@ -5242,7 +5219,6 @@ audioRenderer.on('markReach', 1000, (position) => {
console.info('ON Triggered successfully'); console.info('ON Triggered successfully');
} }
}); });
``` ```
...@@ -5256,15 +5232,14 @@ Unsubscribes from mark reached events. ...@@ -5256,15 +5232,14 @@ Unsubscribes from mark reached events.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| :--- | :----- | :-------- | :------------------------------------------------- | | :----- | :----- | :--- | :------------------------------------------------ |
| type | string | Yes | Event type. The value is fixed at **'markReach'**. | | type | string | Yes | Event type. The value is fixed at **'markReach'**.|
**Example** **Example**
```js ```js
audioRenderer.off('markReach'); audioRenderer.off('markReach');
``` ```
### on('periodReach') <sup>8+</sup> ### on('periodReach') <sup>8+</sup>
...@@ -5277,9 +5252,9 @@ Subscribes to period reached events. When the number of frames rendered reaches ...@@ -5277,9 +5252,9 @@ Subscribes to period reached events. When the number of frames rendered reaches
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------------------------------- | | :------- | :----------------------- | :--- | :------------------------------------------ |
| type | string | Yes | Event type. The value is fixed at **'periodReach'**. | | type | string | Yes | Event type. The value is fixed at **'periodReach'**.|
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. | | frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. |
| callback | Callback\<number> | Yes | Callback invoked when the event is triggered. | | callback | Callback\<number> | Yes | Callback invoked when the event is triggered. |
...@@ -5291,7 +5266,6 @@ audioRenderer.on('periodReach', 1000, (position) => { ...@@ -5291,7 +5266,6 @@ audioRenderer.on('periodReach', 1000, (position) => {
console.info('ON Triggered successfully'); console.info('ON Triggered successfully');
} }
}); });
``` ```
### off('periodReach') <sup>8+</sup> ### off('periodReach') <sup>8+</sup>
...@@ -5304,15 +5278,14 @@ Unsubscribes from period reached events. ...@@ -5304,15 +5278,14 @@ Unsubscribes from period reached events.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| :--- | :----- | :-------- | :--------------------------------------------------- | | :----- | :----- | :--- | :-------------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'periodReach'**. | | type | string | Yes | Event type. The value is fixed at **'periodReach'**.|
**Example** **Example**
```js ```js
audioRenderer.off('periodReach') audioRenderer.off('periodReach')
``` ```
### on('stateChange')<sup>8+</sup> ### on('stateChange')<sup>8+</sup>
...@@ -5325,9 +5298,9 @@ Subscribes to state change events. ...@@ -5325,9 +5298,9 @@ Subscribes to state change events.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------------------------ | :-------- | :----------------------------------------------------------- | | :------- | :------------------------- | :--- | :------------------------------------------ |
| type | string | Yes | Event type. The value **stateChange** means the state change event. | | type | string | Yes | Event type. The value **stateChange** means the state change event.|
| callback | Callback\<[AudioState](#audiostate8)> | Yes | Callback used to return the state change. | | callback | Callback\<[AudioState](#audiostate8)> | Yes | Callback used to return the state change. |
**Example** **Example**
...@@ -5341,7 +5314,6 @@ audioRenderer.on('stateChange', (state) => { ...@@ -5341,7 +5314,6 @@ audioRenderer.on('stateChange', (state) => {
console.info('audio renderer state is: STATE_RUNNING'); console.info('audio renderer state is: STATE_RUNNING');
} }
}); });
``` ```
## AudioCapturer<sup>8+</sup> ## AudioCapturer<sup>8+</sup>
...@@ -5352,15 +5324,14 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo ...@@ -5352,15 +5324,14 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo
**System capability**: SystemCapability.Multimedia.Audio.Capturer **System capability**: SystemCapability.Multimedia.Audio.Capturer
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
| :----------------- | :------------------------- | :------- | :------- | :-------------------- | | :---- | :------------------------- | :--- | :--- | :--------------- |
| state<sup>8+</sup> | [AudioState](#audiostate8) | Yes | No | Audio capturer state. | | state<sup>8+</sup> | [AudioState](#audiostate8) | Yes| No | Audio capturer state.|
**Example** **Example**
```js ```js
let state = audioCapturer.state; let state = audioCapturer.state;
``` ```
### getCapturerInfo<sup>8+</sup> ### getCapturerInfo<sup>8+</sup>
...@@ -5373,9 +5344,9 @@ Obtains the capturer information of this **AudioCapturer** instance. This API us ...@@ -5373,9 +5344,9 @@ Obtains the capturer information of this **AudioCapturer** instance. This API us
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :-------------------------------- | :-------- | :------------------------------------------------ | | :------- | :-------------------------------- | :--- | :----------------------------------- |
| callback | AsyncCallback<AudioCapturerInfo\> | Yes | Callback used to return the capturer information. | | callback | AsyncCallback<AudioCapturerInfo\> | Yes | Callback used to return the capturer information.|
**Example** **Example**
...@@ -5389,7 +5360,6 @@ audioCapturer.getCapturerInfo((err, capturerInfo) => { ...@@ -5389,7 +5360,6 @@ audioCapturer.getCapturerInfo((err, capturerInfo) => {
console.info(`Capturer flags: ${capturerInfo.capturerFlags}`); console.info(`Capturer flags: ${capturerInfo.capturerFlags}`);
} }
}); });
``` ```
...@@ -5404,8 +5374,8 @@ Obtains the capturer information of this **AudioCapturer** instance. This API us ...@@ -5404,8 +5374,8 @@ Obtains the capturer information of this **AudioCapturer** instance. This API us
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------------------------------------------ | :----------------------------------------------- | | :------------------------------------------------ | :---------------------------------- |
| Promise<[AudioCapturerInfo](#audiocapturerinfo)\> | Promise used to return the capturer information. | | Promise<[AudioCapturerInfo](#audiocapturerinfo)\> | Promise used to return the capturer information.|
**Example** **Example**
...@@ -5422,7 +5392,6 @@ audioCapturer.getCapturerInfo().then((audioParamsGet) => { ...@@ -5422,7 +5392,6 @@ audioCapturer.getCapturerInfo().then((audioParamsGet) => {
}).catch((err) => { }).catch((err) => {
console.error(`AudioFrameworkRecLog: CapturerInfo :ERROR: ${err}`); console.error(`AudioFrameworkRecLog: CapturerInfo :ERROR: ${err}`);
}); });
``` ```
### getStreamInfo<sup>8+</sup> ### getStreamInfo<sup>8+</sup>
...@@ -5435,9 +5404,9 @@ Obtains the stream information of this **AudioCapturer** instance. This API uses ...@@ -5435,9 +5404,9 @@ Obtains the stream information of this **AudioCapturer** instance. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------------------------------------- | :-------- | :---------------------------------------------- | | :------- | :--------------------------------------------------- | :--- | :------------------------------- |
| callback | AsyncCallback<[AudioStreamInfo](#audiostreaminfo8)\> | Yes | Callback used to return the stream information. | | callback | AsyncCallback<[AudioStreamInfo](#audiostreaminfo8)\> | Yes | Callback used to return the stream information.|
**Example** **Example**
...@@ -5453,7 +5422,6 @@ audioCapturer.getStreamInfo((err, streamInfo) => { ...@@ -5453,7 +5422,6 @@ audioCapturer.getStreamInfo((err, streamInfo) => {
console.info(`Capturer encoding type: ${streamInfo.encodingType}`); console.info(`Capturer encoding type: ${streamInfo.encodingType}`);
} }
}); });
``` ```
### getStreamInfo<sup>8+</sup> ### getStreamInfo<sup>8+</sup>
...@@ -5467,8 +5435,8 @@ Obtains the stream information of this **AudioCapturer** instance. This API uses ...@@ -5467,8 +5435,8 @@ Obtains the stream information of this **AudioCapturer** instance. This API uses
**Return value** **Return value**
| Type | Description | | Type | Description |
| :--------------------------------------------- | :--------------------------------------------- | | :--------------------------------------------- | :------------------------------ |
| Promise<[AudioStreamInfo](#audiostreaminfo8)\> | Promise used to return the stream information. | | Promise<[AudioStreamInfo](#audiostreaminfo8)\> | Promise used to return the stream information.|
**Example** **Example**
...@@ -5482,7 +5450,6 @@ audioCapturer.getStreamInfo().then((audioParamsGet) => { ...@@ -5482,7 +5450,6 @@ audioCapturer.getStreamInfo().then((audioParamsGet) => {
}).catch((err) => { }).catch((err) => {
console.error(`getStreamInfo :ERROR: ${err}`); console.error(`getStreamInfo :ERROR: ${err}`);
}); });
``` ```
### getAudioStreamId<sup>9+</sup> ### getAudioStreamId<sup>9+</sup>
...@@ -5495,9 +5462,9 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async ...@@ -5495,9 +5462,9 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :------------------------------------- | | :------- | :--------------------------------------------------- | :--- | :------------------- |
| callback | AsyncCallback<number\> | Yes | Callback used to return the stream ID. | | callback | AsyncCallback<number\> | Yes | Callback used to return the stream ID.|
**Example** **Example**
...@@ -5505,7 +5472,6 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async ...@@ -5505,7 +5472,6 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async
audioCapturer.getAudioStreamId((err, streamid) => { audioCapturer.getAudioStreamId((err, streamid) => {
console.info(`audioCapturer GetStreamId: ${streamid}`); console.info(`audioCapturer GetStreamId: ${streamid}`);
}); });
``` ```
### getAudioStreamId<sup>9+</sup> ### getAudioStreamId<sup>9+</sup>
...@@ -5519,8 +5485,8 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses a promis ...@@ -5519,8 +5485,8 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses a promis
**Return value** **Return value**
| Type | Description | | Type | Description |
| :--------------- | :------------------------------------ | | :----------------| :--------------------- |
| Promise<number\> | Promise used to return the stream ID. | | Promise<number\> | Promise used to return the stream ID.|
**Example** **Example**
...@@ -5530,7 +5496,6 @@ audioCapturer.getAudioStreamId().then((streamid) => { ...@@ -5530,7 +5496,6 @@ audioCapturer.getAudioStreamId().then((streamid) => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### start<sup>8+</sup> ### start<sup>8+</sup>
...@@ -5543,9 +5508,9 @@ Starts capturing. This API uses an asynchronous callback to return the result. ...@@ -5543,9 +5508,9 @@ Starts capturing. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------- | :-------- | :---------------------------------- | | :------- | :------------------- | :--- | :----------------------------- |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -5557,7 +5522,6 @@ audioCapturer.start((err) => { ...@@ -5557,7 +5522,6 @@ audioCapturer.start((err) => {
console.info('Capturer start success.'); console.info('Capturer start success.');
} }
}); });
``` ```
...@@ -5572,8 +5536,8 @@ Starts capturing. This API uses a promise to return the result. ...@@ -5572,8 +5536,8 @@ Starts capturing. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :------------- | :---------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -5589,7 +5553,6 @@ audioCapturer.start().then(() => { ...@@ -5589,7 +5553,6 @@ audioCapturer.start().then(() => {
}).catch((err) => { }).catch((err) => {
console.info(`AudioFrameworkRecLog: Capturer start :ERROR : ${err}`); console.info(`AudioFrameworkRecLog: Capturer start :ERROR : ${err}`);
}); });
``` ```
### stop<sup>8+</sup> ### stop<sup>8+</sup>
...@@ -5602,9 +5565,9 @@ Stops capturing. This API uses an asynchronous callback to return the result. ...@@ -5602,9 +5565,9 @@ Stops capturing. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------- | :-------- | :---------------------------------- | | :------- | :------------------- | :--- | :----------------------------- |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -5616,7 +5579,6 @@ audioCapturer.stop((err) => { ...@@ -5616,7 +5579,6 @@ audioCapturer.stop((err) => {
console.info('Capturer stopped.'); console.info('Capturer stopped.');
} }
}); });
``` ```
...@@ -5631,8 +5593,8 @@ Stops capturing. This API uses a promise to return the result. ...@@ -5631,8 +5593,8 @@ Stops capturing. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :------------- | :---------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -5646,7 +5608,6 @@ audioCapturer.stop().then(() => { ...@@ -5646,7 +5608,6 @@ audioCapturer.stop().then(() => {
}).catch((err) => { }).catch((err) => {
console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`); console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`);
}); });
``` ```
### release<sup>8+</sup> ### release<sup>8+</sup>
...@@ -5659,9 +5620,9 @@ Releases this **AudioCapturer** instance. This API uses an asynchronous callback ...@@ -5659,9 +5620,9 @@ Releases this **AudioCapturer** instance. This API uses an asynchronous callback
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------- | :-------- | :---------------------------------- | | :------- | :------------------- | :--- | :---------------------------------- |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -5673,7 +5634,6 @@ audioCapturer.release((err) => { ...@@ -5673,7 +5634,6 @@ audioCapturer.release((err) => {
console.info('capturer released.'); console.info('capturer released.');
} }
}); });
``` ```
...@@ -5688,8 +5648,8 @@ Releases this **AudioCapturer** instance. This API uses a promise to return the ...@@ -5688,8 +5648,8 @@ Releases this **AudioCapturer** instance. This API uses a promise to return the
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :------------- | :---------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -5703,7 +5663,6 @@ audioCapturer.release().then(() => { ...@@ -5703,7 +5663,6 @@ audioCapturer.release().then(() => {
}).catch((err) => { }).catch((err) => {
console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`); console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`);
}); });
``` ```
### read<sup>8+</sup> ### read<sup>8+</sup>
...@@ -5716,11 +5675,11 @@ Reads the buffer. This API uses an asynchronous callback to return the result. ...@@ -5716,11 +5675,11 @@ Reads the buffer. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------------- | :-------------------------- | :-------- | :----------------------------------- | | :------------- | :-------------------------- | :--- | :------------------------------- |
| size | number | Yes | Number of bytes to read. | | size | number | Yes | Number of bytes to read. |
| isBlockingRead | boolean | Yes | Whether to block the read operation. | | isBlockingRead | boolean | Yes | Whether to block the read operation. |
| callback | AsyncCallback<ArrayBuffer\> | Yes | Callback used to return the buffer. | | callback | AsyncCallback<ArrayBuffer\> | Yes | Callback used to return the buffer.|
**Example** **Example**
...@@ -5737,7 +5696,6 @@ audioCapturer.read(bufferSize, true, async(err, buffer) => { ...@@ -5737,7 +5696,6 @@ audioCapturer.read(bufferSize, true, async(err, buffer) => {
console.info('Success in reading the buffer data'); console.info('Success in reading the buffer data');
} }
}); });
``` ```
### read<sup>8+</sup> ### read<sup>8+</sup>
...@@ -5750,16 +5708,16 @@ Reads the buffer. This API uses a promise to return the result. ...@@ -5750,16 +5708,16 @@ Reads the buffer. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------------- | :------ | :-------- | :----------------------------------- | | :------------- | :------ | :--- | :--------------- |
| size | number | Yes | Number of bytes to read. | | size | number | Yes | Number of bytes to read. |
| isBlockingRead | boolean | Yes | Whether to block the read operation. | | isBlockingRead | boolean | Yes | Whether to block the read operation.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| :-------------------- | :----------------------------------------------------------- | | :-------------------- | :----------------------------------------------------- |
| Promise<ArrayBuffer\> | Promise used to return the result. If the operation is successful, the buffer data read is returned; otherwise, an error code is returned. | | Promise<ArrayBuffer\> | Promise used to return the result. If the operation is successful, the buffer data read is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -5777,7 +5735,6 @@ audioCapturer.read(bufferSize, true).then((buffer) => { ...@@ -5777,7 +5735,6 @@ audioCapturer.read(bufferSize, true).then((buffer) => {
}).catch((err) => { }).catch((err) => {
console.info(`ERROR : ${err}`); console.info(`ERROR : ${err}`);
}); });
``` ```
### getAudioTime<sup>8+</sup> ### getAudioTime<sup>8+</sup>
...@@ -5790,9 +5747,9 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -5790,9 +5747,9 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970).
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :---------------------------------- | | :------- | :--------------------- | :--- | :----------------------------- |
| callback | AsyncCallback<number\> | Yes | Callback used to return the result. | | callback | AsyncCallback<number\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -5800,7 +5757,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -5800,7 +5757,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970).
audioCapturer.getAudioTime((err, timestamp) => { audioCapturer.getAudioTime((err, timestamp) => {
console.info(`Current timestamp: ${timestamp}`); console.info(`Current timestamp: ${timestamp}`);
}); });
``` ```
### getAudioTime<sup>8+</sup> ### getAudioTime<sup>8+</sup>
...@@ -5814,8 +5770,8 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -5814,8 +5770,8 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970).
**Return value** **Return value**
| Type | Description | | Type | Description |
| :--------------- | :------------------------------------ | | :--------------- | :---------------------------- |
| Promise<number\> | Promise used to return the timestamp. | | Promise<number\> | Promise used to return the timestamp.|
**Example** **Example**
...@@ -5825,7 +5781,6 @@ audioCapturer.getAudioTime().then((audioTime) => { ...@@ -5825,7 +5781,6 @@ audioCapturer.getAudioTime().then((audioTime) => {
}).catch((err) => { }).catch((err) => {
console.info(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${err}`); console.info(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${err}`);
}); });
``` ```
### getBufferSize<sup>8+</sup> ### getBufferSize<sup>8+</sup>
...@@ -5838,9 +5793,9 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a ...@@ -5838,9 +5793,9 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :--------------------------------------- | | :------- | :--------------------- | :--- | :----------------------------------- |
| callback | AsyncCallback<number\> | Yes | Callback used to return the buffer size. | | callback | AsyncCallback<number\> | Yes | Callback used to return the buffer size.|
**Example** **Example**
...@@ -5855,7 +5810,6 @@ audioCapturer.getBufferSize((err, bufferSize) => { ...@@ -5855,7 +5810,6 @@ audioCapturer.getBufferSize((err, bufferSize) => {
}); });
} }
}); });
``` ```
### getBufferSize<sup>8+</sup> ### getBufferSize<sup>8+</sup>
...@@ -5869,8 +5823,8 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a ...@@ -5869,8 +5823,8 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
**Return value** **Return value**
| Type | Description | | Type | Description |
| :--------------- | :-------------------------------------- | | :--------------- | :---------------------------------- |
| Promise<number\> | Promise used to return the buffer size. | | Promise<number\> | Promise used to return the buffer size.|
**Example** **Example**
...@@ -5882,14 +5836,13 @@ audioCapturer.getBufferSize().then((data) => { ...@@ -5882,14 +5836,13 @@ audioCapturer.getBufferSize().then((data) => {
}).catch((err) => { }).catch((err) => {
console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ${err}`); console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ${err}`);
}); });
``` ```
### on('audioInterrupt')<sup>10+</sup> ### on('audioInterrupt')<sup>10+</sup>
on(type: 'audioInterrupt', callback: Callback\<InterruptEvent>): void on(type: 'audioInterrupt', callback: Callback\<InterruptEvent>): void
Subscribes to audio interruption events. This API uses a callback to get interrupt events. Subscribes to audio interruption events. This API uses a callback to obtain interrupt events.
Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus changes. The **AudioCapturer** instance proactively gains the focus when the **start** event occurs and releases the focus when the **pause** or **stop** event occurs. Therefore, you do not need to request to gain or release the focus. Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus changes. The **AudioCapturer** instance proactively gains the focus when the **start** event occurs and releases the focus when the **pause** or **stop** event occurs. Therefore, you do not need to request to gain or release the focus.
...@@ -5897,17 +5850,17 @@ Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus ch ...@@ -5897,17 +5850,17 @@ Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus ch
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ | | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio capturing is interrupted. | | type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio capturing is interrupted.|
| callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. | | callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. |
**Error codes** **Error codes**
For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md).
| ID | Error Message | | ID| Error Message|
| ------- | ------------------------------ | | ------- | --------------------------------------------|
| 6800101 | if input parameter value error | | 6800101 | if input parameter value error |
**Example** **Example**
...@@ -5959,7 +5912,6 @@ async function onAudioInterrupt(){ ...@@ -5959,7 +5912,6 @@ async function onAudioInterrupt(){
} }
}); });
} }
``` ```
...@@ -5973,11 +5925,11 @@ Subscribes to mark reached events. When the number of frames captured reaches th ...@@ -5973,11 +5925,11 @@ Subscribes to mark reached events. When the number of frames captured reaches th
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------------------------------- | | :------- | :---------------------- | :--- | :----------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'markReach'**. | | type | string | Yes | Event type. The value is fixed at **'markReach'**. |
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. | | frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. |
| callback | Callback\<number> | Yes | Callback invoked when the event is triggered. | | callback | Callback\<number> | Yes | Callback invoked when the event is triggered.|
**Example** **Example**
...@@ -5987,7 +5939,6 @@ audioCapturer.on('markReach', 1000, (position) => { ...@@ -5987,7 +5939,6 @@ audioCapturer.on('markReach', 1000, (position) => {
console.info('ON Triggered successfully'); console.info('ON Triggered successfully');
} }
}); });
``` ```
### off('markReach')<sup>8+</sup> ### off('markReach')<sup>8+</sup>
...@@ -6000,15 +5951,14 @@ Unsubscribes from mark reached events. ...@@ -6000,15 +5951,14 @@ Unsubscribes from mark reached events.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| :--- | :----- | :-------- | :------------------------------------------------- | | :----- | :----- | :--- | :-------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'markReach'**. | | type | string | Yes | Event type. The value is fixed at **'markReach'**.|
**Example** **Example**
```js ```js
audioCapturer.off('markReach'); audioCapturer.off('markReach');
``` ```
### on('periodReach')<sup>8+</sup> ### on('periodReach')<sup>8+</sup>
...@@ -6021,9 +5971,9 @@ Subscribes to period reached events. When the number of frames captured reaches ...@@ -6021,9 +5971,9 @@ Subscribes to period reached events. When the number of frames captured reaches
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------------------------------- | | :------- | :----------------------- | :--- | :------------------------------------------ |
| type | string | Yes | Event type. The value is fixed at **'periodReach'**. | | type | string | Yes | Event type. The value is fixed at **'periodReach'**.|
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. | | frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. |
| callback | Callback\<number> | Yes | Callback invoked when the event is triggered. | | callback | Callback\<number> | Yes | Callback invoked when the event is triggered. |
...@@ -6035,7 +5985,6 @@ audioCapturer.on('periodReach', 1000, (position) => { ...@@ -6035,7 +5985,6 @@ audioCapturer.on('periodReach', 1000, (position) => {
console.info('ON Triggered successfully'); console.info('ON Triggered successfully');
} }
}); });
``` ```
### off('periodReach')<sup>8+</sup> ### off('periodReach')<sup>8+</sup>
...@@ -6048,15 +5997,14 @@ Unsubscribes from period reached events. ...@@ -6048,15 +5997,14 @@ Unsubscribes from period reached events.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| :--- | :----- | :-------- | :--------------------------------------------------- | | :----- | :----- | :--- | :---------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'periodReach'**. | | type | string | Yes | Event type. The value is fixed at **'periodReach'**.|
**Example** **Example**
```js ```js
audioCapturer.off('periodReach') audioCapturer.off('periodReach')
``` ```
### on('stateChange')<sup>8+</sup> ### on('stateChange')<sup>8+</sup>
...@@ -6069,9 +6017,9 @@ Subscribes to state change events. ...@@ -6069,9 +6017,9 @@ Subscribes to state change events.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------------------------ | :-------- | :----------------------------------------------------------- | | :------- | :------------------------- | :--- | :------------------------------------------ |
| type | string | Yes | Event type. The value **stateChange** means the state change event. | | type | string | Yes | Event type. The value **stateChange** means the state change event.|
| callback | Callback\<[AudioState](#audiostate8)> | Yes | Callback used to return the state change. | | callback | Callback\<[AudioState](#audiostate8)> | Yes | Callback used to return the state change. |
**Example** **Example**
...@@ -6085,7 +6033,6 @@ audioCapturer.on('stateChange', (state) => { ...@@ -6085,7 +6033,6 @@ audioCapturer.on('stateChange', (state) => {
console.info('audio capturer state is: STATE_RUNNING'); console.info('audio capturer state is: STATE_RUNNING');
} }
}); });
``` ```
## ToneType<sup>9+</sup> ## ToneType<sup>9+</sup>
...@@ -6097,7 +6044,7 @@ Enumerates the tone types of the player. ...@@ -6097,7 +6044,7 @@ Enumerates the tone types of the player.
**System capability**: SystemCapability.Multimedia.Audio.Tone **System capability**: SystemCapability.Multimedia.Audio.Tone
| Name | Value | Description | | Name | Value | Description |
| :----------------------------------------------- | :---- | :-------------------------------------------- | | :------------------------------------------------ | :----- | :----------------------------|
| TONE_TYPE_DIAL_0 | 0 | DTMF tone of key 0. | | TONE_TYPE_DIAL_0 | 0 | DTMF tone of key 0. |
| TONE_TYPE_DIAL_1 | 1 | DTMF tone of key 1. | | TONE_TYPE_DIAL_1 | 1 | DTMF tone of key 1. |
| TONE_TYPE_DIAL_2 | 2 | DTMF tone of key 2. | | TONE_TYPE_DIAL_2 | 2 | DTMF tone of key 2. |
...@@ -6145,9 +6092,9 @@ Loads the DTMF tone configuration. This API uses an asynchronous callback to ret ...@@ -6145,9 +6092,9 @@ Loads the DTMF tone configuration. This API uses an asynchronous callback to ret
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :---------------------------------- | | :--------------| :-------------------------- | :-----| :------------------------------ |
| type | [ToneType](#tonetype9) | Yes | Tone type. | | type | [ToneType](#tonetype9) | Yes | Tone type. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -6160,7 +6107,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_5, (err) => { ...@@ -6160,7 +6107,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_5, (err) => {
console.info('callback call load success'); console.info('callback call load success');
} }
}); });
``` ```
### load<sup>9+</sup> ### load<sup>9+</sup>
...@@ -6176,14 +6122,14 @@ Loads the DTMF tone configuration. This API uses a promise to return the result. ...@@ -6176,14 +6122,14 @@ Loads the DTMF tone configuration. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :--- | :--------------------- | :-------- | ----------- | | :------------- | :--------------------- | :--- | ---------------- |
| type | [ToneType](#tonetype9) | Yes | Tone type. | | type | [ToneType](#tonetype9) | Yes | Tone type. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :--------------| :-------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -6193,7 +6139,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_1).then(() => { ...@@ -6193,7 +6139,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_1).then(() => {
}).catch(() => { }).catch(() => {
console.error('promise call load fail'); console.error('promise call load fail');
}); });
``` ```
### start<sup>9+</sup> ### start<sup>9+</sup>
...@@ -6208,9 +6153,9 @@ Starts DTMF tone playing. This API uses an asynchronous callback to return the r ...@@ -6208,9 +6153,9 @@ Starts DTMF tone playing. This API uses an asynchronous callback to return the r
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------- | :-------- | :---------------------------------- | | :------- | :------------------- | :--- | :----------------------------- |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -6223,7 +6168,6 @@ tonePlayer.start((err) => { ...@@ -6223,7 +6168,6 @@ tonePlayer.start((err) => {
console.info('callback call start success'); console.info('callback call start success');
} }
}); });
``` ```
### start<sup>9+</sup> ### start<sup>9+</sup>
...@@ -6239,8 +6183,8 @@ Starts DTMF tone playing. This API uses a promise to return the result. ...@@ -6239,8 +6183,8 @@ Starts DTMF tone playing. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :------------- | :---------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -6250,7 +6194,6 @@ tonePlayer.start().then(() => { ...@@ -6250,7 +6194,6 @@ tonePlayer.start().then(() => {
}).catch(() => { }).catch(() => {
console.error('promise call start fail'); console.error('promise call start fail');
}); });
``` ```
### stop<sup>9+</sup> ### stop<sup>9+</sup>
...@@ -6265,9 +6208,9 @@ Stops the tone that is being played. This API uses an asynchronous callback to r ...@@ -6265,9 +6208,9 @@ Stops the tone that is being played. This API uses an asynchronous callback to r
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------- | :-------- | :---------------------------------- | | :------- | :------------------- | :--- | :----------------------------- |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -6280,7 +6223,6 @@ tonePlayer.stop((err) => { ...@@ -6280,7 +6223,6 @@ tonePlayer.stop((err) => {
console.error('callback call stop success '); console.error('callback call stop success ');
} }
}); });
``` ```
### stop<sup>9+</sup> ### stop<sup>9+</sup>
...@@ -6296,8 +6238,8 @@ Stops the tone that is being played. This API uses a promise to return the resul ...@@ -6296,8 +6238,8 @@ Stops the tone that is being played. This API uses a promise to return the resul
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :------------- | :---------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -6307,7 +6249,6 @@ tonePlayer.stop().then(() => { ...@@ -6307,7 +6249,6 @@ tonePlayer.stop().then(() => {
}).catch(() => { }).catch(() => {
console.error('promise call stop fail'); console.error('promise call stop fail');
}); });
``` ```
### release<sup>9+</sup> ### release<sup>9+</sup>
...@@ -6322,8 +6263,8 @@ Releases the resources associated with the **TonePlayer** instance. This API use ...@@ -6322,8 +6263,8 @@ Releases the resources associated with the **TonePlayer** instance. This API use
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :------------------- | :-------- | :---------------------------------- | | :------- | :------------------- | :--- | :---------------------------- |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -6337,7 +6278,6 @@ tonePlayer.release((err) => { ...@@ -6337,7 +6278,6 @@ tonePlayer.release((err) => {
console.info('callback call release success '); console.info('callback call release success ');
} }
}); });
``` ```
### release<sup>9+</sup> ### release<sup>9+</sup>
...@@ -6353,8 +6293,8 @@ Releases the resources associated with the **TonePlayer** instance. This API use ...@@ -6353,8 +6293,8 @@ Releases the resources associated with the **TonePlayer** instance. This API use
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :------------- | :---------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -6364,7 +6304,6 @@ tonePlayer.release().then(() => { ...@@ -6364,7 +6304,6 @@ tonePlayer.release().then(() => {
}).catch(() => { }).catch(() => {
console.error('promise call release fail'); console.error('promise call release fail');
}); });
``` ```
## ActiveDeviceType<sup>(deprecated)</sup> ## ActiveDeviceType<sup>(deprecated)</sup>
...@@ -6378,9 +6317,9 @@ Enumerates the active device types. ...@@ -6378,9 +6317,9 @@ Enumerates the active device types.
**System capability**: SystemCapability.Multimedia.Audio.Device **System capability**: SystemCapability.Multimedia.Audio.Device
| Name | Value | Description | | Name | Value | Description |
| ------------- | ----- | ------------------------------------------------------------ | | ------------- | ------ | ---------------------------------------------------- |
| SPEAKER | 2 | Speaker. | | SPEAKER | 2 | Speaker. |
| BLUETOOTH_SCO | 7 | Bluetooth device using Synchronous Connection Oriented (SCO) links. | | BLUETOOTH_SCO | 7 | Bluetooth device using Synchronous Connection Oriented (SCO) links.|
## InterruptActionType<sup>(deprecated)</sup> ## InterruptActionType<sup>(deprecated)</sup>
...@@ -6393,9 +6332,9 @@ Enumerates the returned event types for audio interruption events. ...@@ -6393,9 +6332,9 @@ Enumerates the returned event types for audio interruption events.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Value | Description | | Name | Value | Description |
| -------------- | ----- | ------------------------- | | -------------- | ------ | ------------------ |
| TYPE_ACTIVATED | 0 | Focus gain event. | | TYPE_ACTIVATED | 0 | Focus gain event.|
| TYPE_INTERRUPT | 1 | Audio interruption event. | | TYPE_INTERRUPT | 1 | Audio interruption event.|
## AudioInterrupt<sup>(deprecated)</sup> ## AudioInterrupt<sup>(deprecated)</sup>
...@@ -6407,11 +6346,11 @@ Describes input parameters of audio interruption events. ...@@ -6407,11 +6346,11 @@ Describes input parameters of audio interruption events.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| --------------- | --------------------------- | --------- | ------------------------------------------------------------ | | --------------- | --------------------------- | ----| ------------------------------------------------------------ |
| streamUsage | [StreamUsage](#streamusage) | Yes | Audio stream usage. | | streamUsage | [StreamUsage](#streamusage) | Yes | Audio stream usage. |
| contentType | [ContentType](#contenttype) | Yes | Audio content type. | | contentType | [ContentType](#contenttype) | Yes | Audio content type. |
| pauseWhenDucked | boolean | Yes | Whether audio playback can be paused during audio interruption. The value **true** means that audio playback can be paused during audio interruption, and **false** means the opposite. | | pauseWhenDucked | boolean | Yes | Whether audio playback can be paused during audio interruption. The value **true** means that audio playback can be paused during audio interruption, and **false** means the opposite.|
## InterruptAction<sup>(deprecated)</sup> ## InterruptAction<sup>(deprecated)</sup>
...@@ -6423,9 +6362,9 @@ Describes the callback invoked for audio interruption or focus gain events. ...@@ -6423,9 +6362,9 @@ Describes the callback invoked for audio interruption or focus gain events.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ---------- | ----------------------------------------------------- | --------- | ------------------------------------------------------------ | | ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| actionType | [InterruptActionType](#interruptactiontypedeprecated) | Yes | Returned event type. The value **TYPE_ACTIVATED** means the focus gain event, and **TYPE_INTERRUPT** means the audio interruption event. | | actionType | [InterruptActionType](#interruptactiontypedeprecated) | Yes | Returned event type. The value **TYPE_ACTIVATED** means the focus gain event, and **TYPE_INTERRUPT** means the audio interruption event.|
| type | [InterruptType](#interrupttype) | No | Type of the audio interruption event. | | type | [InterruptType](#interrupttype) | No | Type of the audio interruption event. |
| hint | [InterruptHint](#interrupthint) | No | Hint provided along with the audio interruption event. | | hint | [InterruptHint](#interrupthint) | No | Hint provided along with the audio interruption event. |
| activated | boolean | No | Whether the focus is gained or released. The value **true** means that the focus is gained or released, and **false** means that the focus fails to be gained or released. | | activated | boolean | No | Whether the focus is gained or released. The value **true** means that the focus is gained or released, and **false** means that the focus fails to be gained or released.|
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册