This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
Currently, when multiple **AudioManager** instances are used in a single process, only the subscription of the last instance takes effect, and the subscription of other instances is overwritten (even if the last instance does not initiate a subscription). Therefore, you are advised to use a single **AudioManager** instance.
Currently, when multiple **AudioManager** instances are used in a single process, only the subscription of the last instance takes effect, and the subscription of other instances is overwritten (even if the last instance does not initiate a subscription). Therefore, you are advised to use a single **AudioManager** instance.
...
@@ -1608,11 +1608,11 @@ Currently, when multiple **AudioManager** instances are used in a single process
...
@@ -1608,11 +1608,11 @@ Currently, when multiple **AudioManager** instances are used in a single process
**Example**
**Example**
```
```js
audioManager.on('volumeChange',(volumeEvent)=>{
audioManager.on('volumeChange',(volumeEvent)=>{
console.log(`VolumeType of stream: ` + volumeEvent.volumeType);
console.info(`VolumeType of stream: ${volumeEvent.volumeType} `);
| type | string | Yes | Event type. The value **ringerModeChange** means the ringer mode change event, which is triggered when a ringer mode change is detected.|
| type | string | Yes | Event type. The value **ringerModeChange** means the ringer mode change event, which is triggered when a ringer mode change is detected.|
| callback | Callback<[AudioRingMode](#audioringmode)> | Yes | Callback used to return the updated ringer mode. |
| callback | Callback<[AudioRingMode](#audioringmode)> | Yes | Callback used to return the system volume change event. |
console.log(`Promise returned to indicate a successful setting of the audio scene mode.`);
console.info('Promise returned to indicate a successful setting of the audio scene mode.');
}).catch((err)=>{
}).catch((err)=>{
console.log(`Failed to set the audio scene mode`);
console.error(`Failed to set the audio scene mode ${err.message}`);
});
});
```
```
...
@@ -1835,13 +1835,13 @@ Obtains the audio scene. This API uses an asynchronous callback to return the re
...
@@ -1835,13 +1835,13 @@ Obtains the audio scene. This API uses an asynchronous callback to return the re
**Example**
**Example**
```
```js
audioManager.getAudioScene((err,value)=>{
audioManager.getAudioScene((err,value)=>{
if(err){
if(err){
console.error(`Failed to obtain the audio scene mode. ${err.message}`);
console.error(`Failed to obtain the audio scene mode. ${err.message}`);
return;
return;
}
}
console.log(`Callback invoked to indicate that the audio scene mode is obtained.` + value);
console.info(`Callback invoked to indicate that the audio scene mode is obtained ${value}.`);
});
});
```
```
...
@@ -1862,11 +1862,11 @@ Obtains the audio scene. This API uses a promise to return the result.
...
@@ -1862,11 +1862,11 @@ Obtains the audio scene. This API uses a promise to return the result.
**Example**
**Example**
```
```js
audioManager.getAudioScene().then((value)=>{
audioManager.getAudioScene().then((value)=>{
console.log(`Promise returned to indicate that the audio scene mode is obtained.` + value);
console.info(`Promise returned to indicate that the audio scene mode is obtained ${value}.`);
}).catch((err)=>{
}).catch((err)=>{
console.log(`Failed to obtain the audio scene mode`);
console.error(`Failed to obtain the audio scene mode ${err.message}`);
});
});
```
```
...
@@ -1889,32 +1889,31 @@ Obtains the information about the current audio renderers. This API uses an asyn
...
@@ -1889,32 +1889,31 @@ Obtains the information about the current audio renderers. This API uses an asyn
| callback | AsyncCallback<[AudioRendererChangeInfoArray](#audiorendererchangeinfoarray9)> | Yes | Callback used to return the audio renderer information.|
| callback | AsyncCallback<[AudioRendererChangeInfoArray](#audiorendererchangeinfoarray9)> | Yes | Callback used to return the audio renderer information.|
@@ -1982,29 +1981,29 @@ Obtains the information about the current audio capturers. This API uses an asyn
...
@@ -1982,29 +1981,29 @@ Obtains the information about the current audio capturers. This API uses an asyn
| callback | AsyncCallback<[AudioCapturerChangeInfoArray](#audiocapturerchangeinfoarray9)> | Yes | Callback used to return the audio capturer information.|
| callback | AsyncCallback<[AudioCapturerChangeInfoArray](#audiocapturerchangeinfoarray9)> | Yes | Callback used to return the audio capturer information.|
| type | string | Yes | Event type. The value **periodReach** means the period reached event, which is triggered when the period of frame rendering reaches the value of the **frame** parameter.|
| type | string | Yes | Event type. The value **periodReach** means the period reached event, which is triggered when the period of frame rendering reaches the value of the **frame** parameter.|
| frame | number | Yes | Period during which frame rendering is listened. 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 | (position: number) => {} | Yes | Callback invoked when the event is triggered. |
| callback | (position: number) => {} | Yes | Callback invoked when the event is triggered. |
**Example**
**Example**
```
```js
audioRenderer.on('periodReach',1000,(position)=>{
audioRenderer.on('periodReach',1000,(position)=>{
if(position==1000){
if(position==1000){
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
}
});
});
```
```
...
@@ -3331,7 +3330,7 @@ Unsubscribes from period reached events.
...
@@ -3331,7 +3330,7 @@ Unsubscribes from period reached events.
**Example**
**Example**
```
```js
audioRenderer.off('periodReach')
audioRenderer.off('periodReach')
```
```
...
@@ -3352,13 +3351,13 @@ Subscribes to state change events.
...
@@ -3352,13 +3351,13 @@ Subscribes to state change events.
**Example**
**Example**
```
```js
audioRenderer.on('stateChange',(state)=>{
audioRenderer.on('stateChange',(state)=>{
if(state==1){
if(state==1){
console.log(`audio renderer state is: STATE_PREPARED`);
console.info('audio renderer state is: STATE_PREPARED');
}
}
if(state==2){
if(state==2){
console.log(`audio renderer state is: STATE_RUNNING`);
console.info('audio renderer state is: STATE_RUNNING');
}
}
});
});
```
```
...
@@ -3377,7 +3376,7 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo
...
@@ -3377,7 +3376,7 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo
**Example**
**Example**
```
```js
varstate=audioCapturer.state;
varstate=audioCapturer.state;
```
```
...
@@ -3397,14 +3396,14 @@ Obtains the capturer information of this **AudioCapturer** instance. This API us
...
@@ -3397,14 +3396,14 @@ Obtains the capturer information of this **AudioCapturer** instance. This API us
| type | string | Yes | Event type. The value **markReach** means the mark reached event, which is triggered when the number of frames captured reaches the value of the **frame** parameter. |
| type | string | Yes | Event type. The value **markReach** means the mark reached event, which is triggered when the number of frames captured reaches the value of the **frame** parameter. |
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. |
| frame | number | Yes | Number of frames to trigger the event. The value must be greater than **0**. |
| callback | position: number) => {} | Yes | Callback invoked when the event is triggered.|
| callback | (position: number) => {} | Yes | Callback invoked when the event is triggered.|
**Example**
**Example**
```
```js
audioCapturer.on('markReach',1000,(position)=>{
audioCapturer.on('markReach',1000,(position)=>{
if(position==1000){
if(position==1000){
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
}
});
});
```
```
...
@@ -3912,7 +3910,7 @@ Unsubscribes from mark reached events.
...
@@ -3912,7 +3910,7 @@ Unsubscribes from mark reached events.
**Example**
**Example**
```
```js
audioCapturer.off('markReach');
audioCapturer.off('markReach');
```
```
...
@@ -3928,16 +3926,16 @@ Subscribes to mark reached events. When the period of frame capturing reaches th
...
@@ -3928,16 +3926,16 @@ Subscribes to mark reached events. When the period of frame capturing reaches th
| type | string | Yes | Event type. The value **periodReach** means the period reached event, which is triggered when the period of frame capturing reaches the value of the **frame** parameter. |
| type | string | Yes | Event type. The value **periodReach** means the period reached event, which is triggered when the period of frame rendering reaches the value of the **frame** parameter.|
| frame | number | Yes | Period during which frame capturing is listened. 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 | (position: number) => {} | Yes | Callback invoked when the event is triggered. |
| callback | (position: number) => {} | Yes | Callback invoked when the event is triggered. |
**Example**
**Example**
```
```js
audioCapturer.on('periodReach',1000,(position)=>{
audioCapturer.on('periodReach',1000,(position)=>{
if(position==1000){
if(position==1000){
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
}
});
});
```
```
...
@@ -3958,7 +3956,7 @@ Unsubscribes from period reached events.
...
@@ -3958,7 +3956,7 @@ Unsubscribes from period reached events.
**Example**
**Example**
```
```js
audioCapturer.off('periodReach')
audioCapturer.off('periodReach')
```
```
...
@@ -3979,13 +3977,13 @@ Subscribes to state change events.
...
@@ -3979,13 +3977,13 @@ Subscribes to state change events.
**Example**
**Example**
```
```js
audioCapturer.on('stateChange',(state)=>{
audioCapturer.on('stateChange',(state)=>{
if(state==1){
if(state==1){
console.log(`audio capturer state is: STATE_PREPARED`);
console.info('audio capturer state is: STATE_PREPARED');
}
}
if(state==2){
if(state==2){
console.log(`audio capturer state is: STATE_RUNNING`);
console.info('audio capturer state is: STATE_RUNNING');