提交 fe33a791 编写于 作者: G Gloria

Update docs against 15751+15922+15644

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 874ddfa3
...@@ -27,32 +27,43 @@ Before developing the audio data collection feature, configure the **ohos.permis ...@@ -27,32 +27,43 @@ Before developing the audio data collection feature, configure the **ohos.permis
For details about the APIs, see [AudioCapturer in Audio Management](../reference/apis/js-apis-audio.md#audiocapturer8). For details about the APIs, see [AudioCapturer in Audio Management](../reference/apis/js-apis-audio.md#audiocapturer8).
1. Use **createAudioCapturer()** to create an **AudioCapturer** instance. 1. Use **createAudioCapturer()** to create a global **AudioCapturer** instance.
Set parameters of the **AudioCapturer** instance in **audioCapturerOptions**. This instance is used to capture audio, control and obtain the recording state, and register a callback for notification. Set parameters of the **AudioCapturer** instance in **audioCapturerOptions**. This instance is used to capture audio, control and obtain the recording state, and register a callback for notification.
```js ```js
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import fs from '@ohos.file.fs'; // It will be used for the call of the read function in step 3.
// Perform a self-test on APIs related to audio rendering.
@Entry
@Component
struct AudioRenderer {
@State message: string = 'Hello World'
private audioCapturer: audio.AudioCapturer; // It will be called globally.
async initAudioCapturer(){
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let audioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0 // 0 is the extended flag bit of the audio capturer. The default value is 0.
}
let audioCapturerOptions = {
streamInfo: audioStreamInfo,
capturerInfo: audioCapturerInfo
}
this.audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
console.log('AudioRecLog: Create audio capturer success.');
}
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let audioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0 // 0 is the extended flag bit of the audio capturer. The default value is 0.
}
let audioCapturerOptions = {
streamInfo: audioStreamInfo,
capturerInfo: audioCapturerInfo
}
let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
console.log('AudioRecLog: Create audio capturer success.');
``` ```
2. Use **start()** to start audio recording. 2. Use **start()** to start audio recording.
...@@ -60,23 +71,18 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference ...@@ -60,23 +71,18 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference
The capturer state will be **STATE_RUNNING** once the audio capturer is started. The application can then begin reading buffers. The capturer state will be **STATE_RUNNING** once the audio capturer is started. The application can then begin reading buffers.
```js ```js
import audio from '@ohos.multimedia.audio'; async startCapturer() {
let state = this.audioCapturer.state;
async function startCapturer() {
let state = audioCapturer.state;
// The audio capturer should be in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state after being started. // The audio capturer should be in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state after being started.
if (state != audio.AudioState.STATE_PREPARED || state != audio.AudioState.STATE_PAUSED || if (state == audio.AudioState.STATE_PREPARED || state == audio.AudioState.STATE_PAUSED ||
state != audio.AudioState.STATE_STOPPED) { state == audio.AudioState.STATE_STOPPED) {
console.info('Capturer is not in a correct state to start'); await this.audioCapturer.start();
return; state = this.audioCapturer.state;
} if (state == audio.AudioState.STATE_RUNNING) {
await audioCapturer.start(); console.info('AudioRecLog: Capturer started');
} else {
state = audioCapturer.state; console.error('AudioRecLog: Capturer start failed');
if (state == audio.AudioState.STATE_RUNNING) { }
console.info('AudioRecLog: Capturer started');
} else {
console.error('AudioRecLog: Capturer start failed');
} }
} }
``` ```
...@@ -86,91 +92,88 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference ...@@ -86,91 +92,88 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference
The following example shows how to write recorded data into a file. The following example shows how to write recorded data into a file.
```js ```js
import fs from '@ohos.file.fs'; async readData(){
let state = this.audioCapturer.state;
let state = audioCapturer.state; // The read operation can be performed only when the state is STATE_RUNNING.
// The read operation can be performed only when the state is STATE_RUNNING. if (state != audio.AudioState.STATE_RUNNING) {
if (state != audio.AudioState.STATE_RUNNING) { console.info('Capturer is not in a correct state to read');
console.info('Capturer is not in a correct state to read'); return;
return;
}
const path = '/data/data/.pulse_dir/capture_js.wav'; // Path for storing the collected audio file.
let file = fs.openSync(filePath, 0o2);
let fd = file.fd;
if (file !== null) {
console.info('AudioRecLog: file created');
} else {
console.info('AudioRecLog: file create : FAILED');
return;
}
if (fd !== null) {
console.info('AudioRecLog: file fd opened in append mode');
}
let numBuffersToCapture = 150; // Write data for 150 times.
let count = 0;
while (numBuffersToCapture) {
let bufferSize = await audioCapturer.getBufferSize();
let buffer = await audioCapturer.read(bufferSize, true);
let options = {
offset: count * this.bufferSize,
length: this.bufferSize
} }
if (typeof(buffer) == undefined) { const path = '/data/data/.pulse_dir/capture_js.wav'; // Path for storing the collected audio file.
console.info('AudioRecLog: read buffer failed'); let file = fs.openSync(path, 0o2);
let fd = file.fd;
if (file !== null) {
console.info('AudioRecLog: file created');
} else { } else {
let number = fs.writeSync(fd, buffer, options); console.info('AudioRecLog: file create : FAILED');
console.info(`AudioRecLog: data written: ${number}`); return;
} }
numBuffersToCapture--; if (fd !== null) {
count++; console.info('AudioRecLog: file fd opened in append mode');
}
let numBuffersToCapture = 150; // Write data for 150 times.
let count = 0;
while (numBuffersToCapture) {
this.bufferSize = await this.audioCapturer.getBufferSize();
let buffer = await this.audioCapturer.read(this.bufferSize, true);
let options = {
offset: count * this.bufferSize,
length: this.bufferSize
}
if (typeof(buffer) == undefined) {
console.info('AudioRecLog: read buffer failed');
} else {
let number = fs.writeSync(fd, buffer, options);
console.info(`AudioRecLog: data written: ${number}`);
}
numBuffersToCapture--;
count++;
}
} }
``` ```
4. Once the recording is complete, call **stop()** to stop the recording. 4. Once the recording is complete, call **stop()** to stop the recording.
```js ```js
async function StopCapturer() { async StopCapturer() {
let state = audioCapturer.state; let state = this.audioCapturer.state;
// The audio capturer can be stopped only when it is in STATE_RUNNING or STATE_PAUSED state. // The audio capturer can be stopped only when it is in STATE_RUNNING or STATE_PAUSED state.
if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) {
console.info('AudioRecLog: Capturer is not running or paused'); console.info('AudioRecLog: Capturer is not running or paused');
return; return;
} }
await audioCapturer.stop(); await this.audioCapturer.stop();
state = audioCapturer.state; state = this.audioCapturer.state;
if (state == audio.AudioState.STATE_STOPPED) { if (state == audio.AudioState.STATE_STOPPED) {
console.info('AudioRecLog: Capturer stopped'); console.info('AudioRecLog: Capturer stopped');
} else { } else {
console.error('AudioRecLog: Capturer stop failed'); console.error('AudioRecLog: Capturer stop failed');
} }
} }
``` ```
5. After the task is complete, call **release()** to release related resources. 5. After the task is complete, call **release()** to release related resources.
```js ```js
async function releaseCapturer() { async releaseCapturer() {
let state = audioCapturer.state; let state = this.audioCapturer.state;
// The audio capturer can be released only when it is not in the STATE_RELEASED or STATE_NEW state. // The audio capturer can be released only when it is not in the STATE_RELEASED or STATE_NEW state.
if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) {
console.info('AudioRecLog: Capturer already released'); console.info('AudioRecLog: Capturer already released');
return; return;
} }
await audioCapturer.release(); await this.audioCapturer.release();
state = audioCapturer.state; state = this.audioCapturer.state;
if (state == audio.AudioState.STATE_RELEASED) { if (state == audio.AudioState.STATE_RELEASED) {
console.info('AudioRecLog: Capturer released'); console.info('AudioRecLog: Capturer released');
} else { } else {
console.info('AudioRecLog: Capturer release failed'); console.info('AudioRecLog: Capturer release failed');
} }
} }
``` ```
6. (Optional) Obtain the audio capturer information. 6. (Optional) Obtain the audio capturer information.
...@@ -178,23 +181,20 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference ...@@ -178,23 +181,20 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference
You can use the following code to obtain the audio capturer information: You can use the following code to obtain the audio capturer information:
```js ```js
// Obtain the audio capturer state. async getAudioCapturerInfo(){
let state = audioCapturer.state; // Obtain the audio capturer state.
let state = this.audioCapturer.state;
// Obtain the audio capturer information. // Obtain the audio capturer information.
let audioCapturerInfo : audio.AuduioCapturerInfo = await audioCapturer.getCapturerInfo(); let audioCapturerInfo : audio.AudioCapturerInfo = await this.audioCapturer.getCapturerInfo();
// Obtain the audio stream information.
// Obtain the audio stream information. let audioStreamInfo : audio.AudioStreamInfo = await this.audioCapturer.getStreamInfo();
let audioStreamInfo : audio.AudioStreamInfo = await audioCapturer.getStreamInfo(); // Obtain the audio stream ID.
let audioStreamId : number = await this.audioCapturer.getAudioStreamId();
// Obtain the audio stream ID. // Obtain the Unix timestamp, in nanoseconds.
let audioStreamId : number = await audioCapturer.getAudioStreamId(); let audioTime : number = await this.audioCapturer.getAudioTime();
// Obtain a proper minimum buffer size.
// Obtain the Unix timestamp, in nanoseconds. let bufferSize : number = await this.audioCapturer.getBufferSize();
let audioTime : number = await audioCapturer.getAudioTime(); }
// Obtain a proper minimum buffer size.
let bufferSize : number = await audioCapturer.getBufferSize();
``` ```
7. (Optional) Use **on('markReach')** to subscribe to the mark reached event, and use **off('markReach')** to unsubscribe from the event. 7. (Optional) Use **on('markReach')** to subscribe to the mark reached event, and use **off('markReach')** to unsubscribe from the event.
...@@ -202,12 +202,13 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference ...@@ -202,12 +202,13 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference
After the mark reached event is subscribed to, when the number of frames collected by the audio capturer reaches the specified value, a callback is triggered and the specified value is returned. After the mark reached event is subscribed to, when the number of frames collected by the audio capturer reaches the specified value, a callback is triggered and the specified value is returned.
```js ```js
audioCapturer.on('markReach', (reachNumber) => { async markReach(){
console.info('Mark reach event Received'); this.audioCapturer.on('markReach', 10, (reachNumber) => {
console.info(`The Capturer reached frame: ${reachNumber}`); console.info('Mark reach event Received');
}); console.info(`The Capturer reached frame: ${reachNumber}`);
});
audioCapturer.off('markReach'); // Unsubscribe from the mark reached event. This event will no longer be listened for. this.audioCapturer.off('markReach'); // Unsubscribe from the mark reached event. This event will no longer be listened for.
}
``` ```
8. (Optional) Use **on('periodReach')** to subscribe to the period reached event, and use **off('periodReach')** to unsubscribe from the event. 8. (Optional) Use **on('periodReach')** to subscribe to the period reached event, and use **off('periodReach')** to unsubscribe from the event.
...@@ -215,40 +216,43 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference ...@@ -215,40 +216,43 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference
After the period reached event is subscribed to, each time the number of frames collected by the audio capturer reaches the specified value, a callback is triggered and the specified value is returned. After the period reached event is subscribed to, each time the number of frames collected by the audio capturer reaches the specified value, a callback is triggered and the specified value is returned.
```js ```js
audioCapturer.on('periodReach', (reachNumber) => { async periodReach(){
console.info('Period reach event Received'); this.audioCapturer.on('periodReach', 10, (reachNumber) => {
console.info(`In this period, the Capturer reached frame: ${reachNumber}`); console.info('Period reach event Received');
}); console.info(`In this period, the Capturer reached frame: ${reachNumber}`);
});
audioCapturer.off('periodReach'); // Unsubscribe from the period reached event. This event will no longer be listened for. this.audioCapturer.off('periodReach'); // Unsubscribe from the period reached event. This event will no longer be listened for.
}
``` ```
9. If your application needs to perform some operations when the audio capturer state is updated, it can subscribe to the state change event. When the audio capturer state is updated, the application receives a callback containing the event type. 9. If your application needs to perform some operations when the audio capturer state is updated, it can subscribe to the state change event. When the audio capturer state is updated, the application receives a callback containing the event type.
```js ```js
audioCapturer.on('stateChange', (state) => { async stateChange(){
console.info(`AudioCapturerLog: Changed State to : ${state}`) this.audioCapturer.on('stateChange', (state) => {
switch (state) { console.info(`AudioCapturerLog: Changed State to : ${state}`)
case audio.AudioState.STATE_PREPARED: switch (state) {
console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------'); case audio.AudioState.STATE_PREPARED:
console.info('Audio State is : Prepared'); console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------');
break; console.info('Audio State is : Prepared');
case audio.AudioState.STATE_RUNNING: break;
console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------'); case audio.AudioState.STATE_RUNNING:
console.info('Audio State is : Running'); console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------');
break; console.info('Audio State is : Running');
case audio.AudioState.STATE_STOPPED: break;
console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------'); case audio.AudioState.STATE_STOPPED:
console.info('Audio State is : stopped'); console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------');
break; console.info('Audio State is : stopped');
case audio.AudioState.STATE_RELEASED: break;
console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------'); case audio.AudioState.STATE_RELEASED:
console.info('Audio State is : released'); console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------');
break; console.info('Audio State is : released');
default: break;
console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------'); default:
console.info('Audio State is : invalid'); console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------');
break; console.info('Audio State is : invalid');
} break;
}); }
});
}
``` ```
...@@ -23,9 +23,9 @@ import audio from '@ohos.multimedia.audio'; ...@@ -23,9 +23,9 @@ import audio from '@ohos.multimedia.audio';
| Name | Type | Readable | Writable| Description | | Name | Type | Readable | Writable| Description |
| --------------------------------------- | ----------| ---- | ---- | ------------------ | | --------------------------------------- | ----------| ---- | ---- | ------------------ |
| LOCAL_NETWORK_ID<sup>9+</sup> | string | Yes | No | Network ID of the local device.<br>This is a system API.<br>**System capability**: SystemCapability.Multimedia.Audio.Device | | LOCAL_NETWORK_ID<sup>9+</sup> | string | Yes | No | Network ID of the local device.<br>This is a system API.<br> **System capability**: SystemCapability.Multimedia.Audio.Device |
| DEFAULT_VOLUME_GROUP_ID<sup>9+</sup> | number | Yes | No | Default volume group ID.<br>**System capability**: SystemCapability.Multimedia.Audio.Volume | | DEFAULT_VOLUME_GROUP_ID<sup>9+</sup> | number | Yes | No | Default volume group ID.<br> **System capability**: SystemCapability.Multimedia.Audio.Volume |
| DEFAULT_INTERRUPT_GROUP_ID<sup>9+</sup> | number | Yes | No | Default audio interruption group ID.<br>**System capability**: SystemCapability.Multimedia.Audio.Interrupt | | DEFAULT_INTERRUPT_GROUP_ID<sup>9+</sup> | number | Yes | No | Default audio interruption group ID.<br> **System capability**: SystemCapability.Multimedia.Audio.Interrupt |
**Example** **Example**
...@@ -1763,7 +1763,7 @@ Sets a device to the active state. This API uses an asynchronous callback to ret ...@@ -1763,7 +1763,7 @@ Sets a device to the active state. This API uses an asynchronous callback to ret
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------- | ---- | ------------------------ | | ---------- | ------------------------------------- | ---- | ------------------------ |
| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. |
| active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. | | active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
...@@ -1795,7 +1795,7 @@ Sets a device to the active state. This API uses a promise to return the result. ...@@ -1795,7 +1795,7 @@ Sets a device to the active state. This API uses a promise to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------- | ---- | ------------------ | | ---------- | ------------------------------------- | ---- | ------------------ |
| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type.|
| active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. | | active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. |
**Return value** **Return value**
...@@ -1829,7 +1829,7 @@ Checks whether a device is active. This API uses an asynchronous callback to ret ...@@ -1829,7 +1829,7 @@ Checks whether a device is active. This API uses an asynchronous callback to ret
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------- | ---- | ------------------------ | | ---------- | ------------------------------------- | ---- | ------------------------ |
| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the active state of the device.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the active state of the device.|
**Example** **Example**
...@@ -1860,7 +1860,7 @@ Checks whether a device is active. This API uses a promise to return the result. ...@@ -1860,7 +1860,7 @@ Checks whether a device is active. This API uses a promise to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------- | ---- | ------------------ | | ---------- | ------------------------------------- | ---- | ------------------ |
| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type.|
**Return value** **Return value**
...@@ -3956,6 +3956,7 @@ Describes the audio renderer change event. ...@@ -3956,6 +3956,7 @@ Describes the audio renderer change event.
**Example** **Example**
```js ```js
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
const audioManager = audio.getAudioManager(); const audioManager = audio.getAudioManager();
...@@ -4240,7 +4241,6 @@ audioRenderer.getStreamInfo().then((streamInfo) => { ...@@ -4240,7 +4241,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>
...@@ -4263,7 +4263,6 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async ...@@ -4263,7 +4263,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>
...@@ -4288,7 +4287,6 @@ audioRenderer.getAudioStreamId().then((streamid) => { ...@@ -4288,7 +4287,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>
...@@ -4315,7 +4313,6 @@ audioRenderer.start((err) => { ...@@ -4315,7 +4313,6 @@ audioRenderer.start((err) => {
console.info('Renderer start success.'); console.info('Renderer start success.');
} }
}); });
``` ```
### start<sup>8+</sup> ### start<sup>8+</sup>
...@@ -4340,7 +4337,6 @@ audioRenderer.start().then(() => { ...@@ -4340,7 +4337,6 @@ audioRenderer.start().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### pause<sup>8+</sup> ### pause<sup>8+</sup>
...@@ -4367,7 +4363,6 @@ audioRenderer.pause((err) => { ...@@ -4367,7 +4363,6 @@ audioRenderer.pause((err) => {
console.info('Renderer paused.'); console.info('Renderer paused.');
} }
}); });
``` ```
### pause<sup>8+</sup> ### pause<sup>8+</sup>
...@@ -4392,7 +4387,6 @@ audioRenderer.pause().then(() => { ...@@ -4392,7 +4387,6 @@ audioRenderer.pause().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### drain<sup>8+</sup> ### drain<sup>8+</sup>
...@@ -4419,7 +4413,6 @@ audioRenderer.drain((err) => { ...@@ -4419,7 +4413,6 @@ audioRenderer.drain((err) => {
console.info('Renderer drained.'); console.info('Renderer drained.');
} }
}); });
``` ```
### drain<sup>8+</sup> ### drain<sup>8+</sup>
...@@ -4444,7 +4437,6 @@ audioRenderer.drain().then(() => { ...@@ -4444,7 +4437,6 @@ audioRenderer.drain().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### stop<sup>8+</sup> ### stop<sup>8+</sup>
...@@ -4471,7 +4463,6 @@ audioRenderer.stop((err) => { ...@@ -4471,7 +4463,6 @@ audioRenderer.stop((err) => {
console.info('Renderer stopped.'); console.info('Renderer stopped.');
} }
}); });
``` ```
### stop<sup>8+</sup> ### stop<sup>8+</sup>
...@@ -4496,7 +4487,6 @@ audioRenderer.stop().then(() => { ...@@ -4496,7 +4487,6 @@ audioRenderer.stop().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### release<sup>8+</sup> ### release<sup>8+</sup>
...@@ -4523,7 +4513,6 @@ audioRenderer.release((err) => { ...@@ -4523,7 +4513,6 @@ audioRenderer.release((err) => {
console.info('Renderer released.'); console.info('Renderer released.');
} }
}); });
``` ```
### release<sup>8+</sup> ### release<sup>8+</sup>
...@@ -4548,7 +4537,6 @@ audioRenderer.release().then(() => { ...@@ -4548,7 +4537,6 @@ audioRenderer.release().then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`ERROR: ${err}`); console.error(`ERROR: ${err}`);
}); });
``` ```
### write<sup>8+</sup> ### write<sup>8+</sup>
...@@ -4586,15 +4574,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; ...@@ -4586,15 +4574,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let stat = await fs.stat(path); let stat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) { for (let i = 0;i < len; i++) {
let options = { let options = {
offset: i * this.bufferSize, offset: i * bufferSize,
length: this.bufferSize length: bufferSize
} }
let readsize = await fs.read(file.fd, buf, options) let readsize = await fs.read(file.fd, buf, options)
let writeSize = await new Promise((resolve,reject)=>{ let writeSize = await new Promise((resolve,reject)=>{
this.audioRenderer.write(buf,(err,writeSize)=>{ audioRenderer.write(buf,(err,writeSize)=>{
if(err){ if(err){
reject(err) reject(err)
}else{ }else{
...@@ -4604,7 +4592,6 @@ for (let i = 0;i < len; i++) { ...@@ -4604,7 +4592,6 @@ for (let i = 0;i < len; i++) {
}) })
} }
``` ```
### write<sup>8+</sup> ### write<sup>8+</sup>
...@@ -4641,20 +4628,19 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; ...@@ -4641,20 +4628,19 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let stat = await fs.stat(path); let stat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) { for (let i = 0;i < len; i++) {
let options = { let options = {
offset: i * this.bufferSize, offset: i * bufferSize,
length: this.bufferSize length: bufferSize
} }
let readsize = await fs.read(file.fd, buf, options) let readsize = await fs.read(file.fd, buf, options)
try{ try{
let writeSize = await this.audioRenderer.write(buf); let writeSize = await audioRenderer.write(buf);
} catch(err) { } catch(err) {
console.error(`audioRenderer.write err: ${err}`); console.error(`audioRenderer.write err: ${err}`);
} }
} }
``` ```
### getAudioTime<sup>8+</sup> ### getAudioTime<sup>8+</sup>
...@@ -4677,7 +4663,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -4677,7 +4663,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>
...@@ -4702,7 +4687,6 @@ audioRenderer.getAudioTime().then((timestamp) => { ...@@ -4702,7 +4687,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>
...@@ -4727,7 +4711,6 @@ let bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => { ...@@ -4727,7 +4711,6 @@ let bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => {
console.error('getBufferSize error'); console.error('getBufferSize error');
} }
}); });
``` ```
### getBufferSize<sup>8+</sup> ### getBufferSize<sup>8+</sup>
...@@ -4754,7 +4737,6 @@ audioRenderer.getBufferSize().then((data) => { ...@@ -4754,7 +4737,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>
...@@ -4782,7 +4764,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL, (err) => ...@@ -4782,7 +4764,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>
...@@ -4813,7 +4794,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(() ...@@ -4813,7 +4794,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>
...@@ -4836,7 +4816,6 @@ Obtains the current render rate. This API uses an asynchronous callback to retur ...@@ -4836,7 +4816,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>
...@@ -4861,9 +4840,7 @@ audioRenderer.getRenderRate().then((renderRate) => { ...@@ -4861,9 +4840,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;
...@@ -4893,9 +4870,7 @@ audioRenderer.setInterruptMode(mode).then(data=>{ ...@@ -4893,9 +4870,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
...@@ -4921,7 +4896,6 @@ audioRenderer.setInterruptMode(mode, (err, data)=>{ ...@@ -4921,7 +4896,6 @@ audioRenderer.setInterruptMode(mode, (err, data)=>{
} }
console.info('setInterruptMode Success!'); console.info('setInterruptMode Success!');
}); });
``` ```
### setVolume<sup>9+</sup> ### setVolume<sup>9+</sup>
...@@ -4952,9 +4926,7 @@ audioRenderer.setVolume(0.5).then(data=>{ ...@@ -4952,9 +4926,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
...@@ -4979,7 +4951,6 @@ audioRenderer.setVolume(0.5, (err, data)=>{ ...@@ -4979,7 +4951,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>
...@@ -5005,7 +4976,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco ...@@ -5005,7 +4976,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco
| ID | Error Message | | ID | Error Message |
| ------- | ------------------------------ | | ------- | ------------------------------ |
| 6800101 | if input parameter value error | | 6800101 | if input parameter value error |
**Example** **Example**
...@@ -5059,7 +5030,6 @@ async function onAudioInterrupt(){ ...@@ -5059,7 +5030,6 @@ async function onAudioInterrupt(){
} }
}); });
} }
``` ```
### on('markReach')<sup>8+</sup> ### on('markReach')<sup>8+</sup>
...@@ -5086,7 +5056,6 @@ audioRenderer.on('markReach', 1000, (position) => { ...@@ -5086,7 +5056,6 @@ audioRenderer.on('markReach', 1000, (position) => {
console.info('ON Triggered successfully'); console.info('ON Triggered successfully');
} }
}); });
``` ```
...@@ -5108,7 +5077,6 @@ Unsubscribes from mark reached events. ...@@ -5108,7 +5077,6 @@ Unsubscribes from mark reached events.
```js ```js
audioRenderer.off('markReach'); audioRenderer.off('markReach');
``` ```
### on('periodReach') <sup>8+</sup> ### on('periodReach') <sup>8+</sup>
...@@ -5135,7 +5103,6 @@ audioRenderer.on('periodReach', 1000, (position) => { ...@@ -5135,7 +5103,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>
...@@ -5156,10 +5123,9 @@ Unsubscribes from period reached events. ...@@ -5156,10 +5123,9 @@ Unsubscribes from period reached events.
```js ```js
audioRenderer.off('periodReach') audioRenderer.off('periodReach')
``` ```
### on('stateChange')<sup>8+</sup> ### on('stateChange') <sup>8+</sup>
on(type: 'stateChange', callback: Callback<AudioState\>): void on(type: 'stateChange', callback: Callback<AudioState\>): void
...@@ -5185,7 +5151,6 @@ audioRenderer.on('stateChange', (state) => { ...@@ -5185,7 +5151,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>
...@@ -5204,7 +5169,6 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo ...@@ -5204,7 +5169,6 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo
```js ```js
let state = audioCapturer.state; let state = audioCapturer.state;
``` ```
### getCapturerInfo<sup>8+</sup> ### getCapturerInfo<sup>8+</sup>
...@@ -5233,7 +5197,6 @@ audioCapturer.getCapturerInfo((err, capturerInfo) => { ...@@ -5233,7 +5197,6 @@ audioCapturer.getCapturerInfo((err, capturerInfo) => {
console.info(`Capturer flags: ${capturerInfo.capturerFlags}`); console.info(`Capturer flags: ${capturerInfo.capturerFlags}`);
} }
}); });
``` ```
...@@ -5266,7 +5229,6 @@ audioCapturer.getCapturerInfo().then((audioParamsGet) => { ...@@ -5266,7 +5229,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>
...@@ -5297,7 +5259,6 @@ audioCapturer.getStreamInfo((err, streamInfo) => { ...@@ -5297,7 +5259,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>
...@@ -5326,7 +5287,6 @@ audioCapturer.getStreamInfo().then((audioParamsGet) => { ...@@ -5326,7 +5287,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>
...@@ -5349,7 +5309,6 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async ...@@ -5349,7 +5309,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>
...@@ -5374,7 +5333,6 @@ audioCapturer.getAudioStreamId().then((streamid) => { ...@@ -5374,7 +5333,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>
...@@ -5401,7 +5359,6 @@ audioCapturer.start((err) => { ...@@ -5401,7 +5359,6 @@ audioCapturer.start((err) => {
console.info('Capturer start success.'); console.info('Capturer start success.');
} }
}); });
``` ```
...@@ -5433,7 +5390,6 @@ audioCapturer.start().then(() => { ...@@ -5433,7 +5390,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>
...@@ -5460,7 +5416,6 @@ audioCapturer.stop((err) => { ...@@ -5460,7 +5416,6 @@ audioCapturer.stop((err) => {
console.info('Capturer stopped.'); console.info('Capturer stopped.');
} }
}); });
``` ```
...@@ -5490,7 +5445,6 @@ audioCapturer.stop().then(() => { ...@@ -5490,7 +5445,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>
...@@ -5517,7 +5471,6 @@ audioCapturer.release((err) => { ...@@ -5517,7 +5471,6 @@ audioCapturer.release((err) => {
console.info('capturer released.'); console.info('capturer released.');
} }
}); });
``` ```
...@@ -5547,7 +5500,6 @@ audioCapturer.release().then(() => { ...@@ -5547,7 +5500,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>
...@@ -5581,7 +5533,6 @@ audioCapturer.read(bufferSize, true, async(err, buffer) => { ...@@ -5581,7 +5533,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>
...@@ -5621,7 +5572,6 @@ audioCapturer.read(bufferSize, true).then((buffer) => { ...@@ -5621,7 +5572,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>
...@@ -5644,7 +5594,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). ...@@ -5644,7 +5594,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>
...@@ -5669,7 +5618,6 @@ audioCapturer.getAudioTime().then((audioTime) => { ...@@ -5669,7 +5618,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>
...@@ -5699,7 +5647,6 @@ audioCapturer.getBufferSize((err, bufferSize) => { ...@@ -5699,7 +5647,6 @@ audioCapturer.getBufferSize((err, bufferSize) => {
}); });
} }
}); });
``` ```
### getBufferSize<sup>8+</sup> ### getBufferSize<sup>8+</sup>
...@@ -5726,7 +5673,6 @@ audioCapturer.getBufferSize().then((data) => { ...@@ -5726,7 +5673,6 @@ audioCapturer.getBufferSize().then((data) => {
}).catch((err) => { }).catch((err) => {
console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ${err}`); console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ${err}`);
}); });
``` ```
### on('markReach')<sup>8+</sup> ### on('markReach')<sup>8+</sup>
...@@ -5753,7 +5699,6 @@ audioCapturer.on('markReach', 1000, (position) => { ...@@ -5753,7 +5699,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>
...@@ -5774,7 +5719,6 @@ Unsubscribes from mark reached events. ...@@ -5774,7 +5719,6 @@ Unsubscribes from mark reached events.
```js ```js
audioCapturer.off('markReach'); audioCapturer.off('markReach');
``` ```
### on('periodReach')<sup>8+</sup> ### on('periodReach')<sup>8+</sup>
...@@ -5801,7 +5745,6 @@ audioCapturer.on('periodReach', 1000, (position) => { ...@@ -5801,7 +5745,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>
...@@ -5822,10 +5765,9 @@ Unsubscribes from period reached events. ...@@ -5822,10 +5765,9 @@ Unsubscribes from period reached events.
```js ```js
audioCapturer.off('periodReach') audioCapturer.off('periodReach')
``` ```
### on('stateChange')<sup>8+</sup> ### on('stateChange') <sup>8+</sup>
on(type: 'stateChange', callback: Callback<AudioState\>): void on(type: 'stateChange', callback: Callback<AudioState\>): void
...@@ -5851,7 +5793,6 @@ audioCapturer.on('stateChange', (state) => { ...@@ -5851,7 +5793,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>
...@@ -5926,7 +5867,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_5, (err) => { ...@@ -5926,7 +5867,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>
...@@ -5959,7 +5899,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_1).then(() => { ...@@ -5959,7 +5899,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>
...@@ -5989,7 +5928,6 @@ tonePlayer.start((err) => { ...@@ -5989,7 +5928,6 @@ tonePlayer.start((err) => {
console.info('callback call start success'); console.info('callback call start success');
} }
}); });
``` ```
### start<sup>9+</sup> ### start<sup>9+</sup>
...@@ -6016,7 +5954,6 @@ tonePlayer.start().then(() => { ...@@ -6016,7 +5954,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>
...@@ -6046,7 +5983,6 @@ tonePlayer.stop((err) => { ...@@ -6046,7 +5983,6 @@ tonePlayer.stop((err) => {
console.error('callback call stop success '); console.error('callback call stop success ');
} }
}); });
``` ```
### stop<sup>9+</sup> ### stop<sup>9+</sup>
...@@ -6073,7 +6009,6 @@ tonePlayer.stop().then(() => { ...@@ -6073,7 +6009,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>
...@@ -6103,7 +6038,6 @@ tonePlayer.release((err) => { ...@@ -6103,7 +6038,6 @@ tonePlayer.release((err) => {
console.info('callback call release success '); console.info('callback call release success ');
} }
}); });
``` ```
### release<sup>9+</sup> ### release<sup>9+</sup>
...@@ -6130,7 +6064,6 @@ tonePlayer.release().then(() => { ...@@ -6130,7 +6064,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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册