未验证 提交 8f32e16b 编写于 作者: O openharmony_ci 提交者: Gitee

!6878 js api doc compilation issues fixes

Merge pull request !6878 from rahulkumar/js-api-3.1-release
...@@ -2264,7 +2264,43 @@ Writes the buffer. This API uses an asynchronous callback to return the result. ...@@ -2264,7 +2264,43 @@ Writes the buffer. This API uses an asynchronous callback to return the result.
``` ```
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility'
var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION
rendererFlags: 1
}
var audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
var audioRenderer;
audio.createAudioRenderer(audioRendererOptions).then((data)=> {
audioRenderer = data;
console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
});
var bufferSize;
audioRenderer.getBufferSize().then((data)=> {
console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
});
console.info('Buffer size:'+bufferSize);
var context = featureAbility.getContext();
var path = await context.getCacheDir();
var filePath = path+"/StarWars10s-2C-48000-4SW.wav"
let ss = fileio.createStreamSync(filePath, 'r'); let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
ss.readSync(buf); ss.readSync(buf);
...@@ -2296,7 +2332,42 @@ Writes the buffer. This API uses a promise to return the result. ...@@ -2296,7 +2332,42 @@ Writes the buffer. This API uses a promise to return the result.
``` ```
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility'
var audioStreamInfo = {
samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels:audio.AudioChannel.CHANNEL_2,
sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
var audioRenderer;
audio.createAudioRenderer(audioRendererOptions).then((data) => {
audioRenderer = data;
console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
});
var bufferSize;
audioRenderer.getBufferSize().then((data) => {
console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
});
console.info('BufferSize: ' + bufferSize);
var context = featureAbility.getContext();
var path = await context.getCacheDir();
var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; var filePath = 'data/StarWars10s-2C-48000-4SW.wav';
let ss = fileio.createStreamSync(filePath, 'r'); let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
...@@ -2399,12 +2470,39 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a ...@@ -2399,12 +2470,39 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**Example** **Example**
``` ```
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
var audioStreamInfo = {
samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels:audio.AudioChannel.CHANNEL_2,
sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
var audioRenderer;
audio.createAudioRenderer(audioRendererOptions).then((data) => {
audioRenderer = data;
console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
});
var bufferSize; var bufferSize;
await audioRenderer.getBufferSize().then(async function (data) => { audioRenderer.getBufferSize().then((data) => {
console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize=data; bufferSize=data;
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
}); });
``` ```
...@@ -2597,7 +2695,7 @@ Subscribes to mark reached events. When the number of frames rendered reaches th ...@@ -2597,7 +2695,7 @@ Subscribes to mark reached events. When the number of frames rendered reaches th
``` ```
audioRenderer.on('markReach', 1000, (position) => { audioRenderer.on('markReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
...@@ -2644,7 +2742,7 @@ Subscribes to period reached events. When the period of frame rendering reaches ...@@ -2644,7 +2742,7 @@ Subscribes to period reached events. When the period of frame rendering reaches
``` ```
audioRenderer.on('periodReach', 1000, (position) => { audioRenderer.on('periodReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
...@@ -2878,13 +2976,35 @@ Starts capturing. This API uses a promise to return the result. ...@@ -2878,13 +2976,35 @@ Starts capturing. This API uses a promise to return the result.
**Example** **Example**
``` ```
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags = 1
}
var audioCapturer;
audio.createAudioCapturer(audioCapturerOptions).then((data) => {
audioCapturer = data;
console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message);
});
audioCapturer.start().then(() => { audioCapturer.start().then(() => {
console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: ---------START---------');
console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); console.info('AudioFrameworkRecLog: Capturer started: SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state);
console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); console.info('AudioFrameworkRecLog: Capturer started: SUCCESS ');
if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) {
stateFlag = true; console.info('AudioFrameworkRecLog: AudioCapturer is in Running State');
} }
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message);
...@@ -2937,15 +3057,13 @@ Stops capturing. This API uses a promise to return the result. ...@@ -2937,15 +3057,13 @@ Stops capturing. This API uses a promise to return the result.
``` ```
audioCapturer.stop().then(() => { audioCapturer.stop().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------STOP RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS');
if ((audioCapturer.state == audioCapturer.AudioState.STATE_STOPPED)){ if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){
stateFlag=true; console.info('AudioFrameworkRecLog: State is Stopped': ');
console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
} }
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
stateFlag=false;
}); });
``` ```
...@@ -2997,13 +3115,9 @@ audioCapturer.release().then(() => { ...@@ -2997,13 +3115,9 @@ audioCapturer.release().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
stateFlag=true;
console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag);
expect(stateFlag).assertTrue();
done();
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
stateFlag=false
}); });
``` ```
...@@ -3027,6 +3141,13 @@ Reads the buffer. This API uses an asynchronous callback to return the result. ...@@ -3027,6 +3141,13 @@ Reads the buffer. This API uses an asynchronous callback to return the result.
**Example** **Example**
``` ```
var bufferSize;
audioCapturer.getBufferSize().then((data) => {
console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message);
});
audioCapturer.read(bufferSize, true, async(err, buffer) => { audioCapturer.read(bufferSize, true, async(err, buffer) => {
if (!err) { if (!err) {
console.log("Success in reading the buffer data"); console.log("Success in reading the buffer data");
...@@ -3059,6 +3180,14 @@ Reads the buffer. This API uses a promise to return the result. ...@@ -3059,6 +3180,14 @@ Reads the buffer. This API uses a promise to return the result.
**Example** **Example**
``` ```
var bufferSize;
audioCapturer.getBufferSize().then((data) => {
console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message);
});
console.info('Buffer size: ' + bufferSize);
audioCapturer.read(bufferSize, true).then((buffer) => { audioCapturer.read(bufferSize, true).then((buffer) => {
console.info('buffer read successfully'); console.info('buffer read successfully');
}).catch((err) => { }).catch((err) => {
...@@ -3162,15 +3291,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a ...@@ -3162,15 +3291,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
**Example** **Example**
``` ```
audioCapturer.getBufferSize().then((bufferSize) => { var bufferSize;
if (!err) { audioCapturer.getBufferSize().then((data) => {
console.log('BufferSize : ' + bufferSize); console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data);
audioCapturer.read(bufferSize, true).then((buffer) => { bufferSize = data;
console.info('Buffer read is ' + buffer ); }).catch((err) => {
}).catch((err) => { console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message);
console.info('ERROR : '+err.message);
});
}
}); });
``` ```
...@@ -3195,7 +3321,7 @@ Subscribes to mark reached events. When the number of frames captured reaches th ...@@ -3195,7 +3321,7 @@ Subscribes to mark reached events. When the number of frames captured reaches th
``` ```
audioCapturer.on('markReach', 1000, (position) => { audioCapturer.on('markReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
...@@ -3241,7 +3367,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th ...@@ -3241,7 +3367,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th
``` ```
audioCapturer.on('periodReach', 1000, (position) => { audioCapturer.on('periodReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
......
...@@ -2267,7 +2267,43 @@ write(buffer: ArrayBuffer, callback: AsyncCallback\<number>): void ...@@ -2267,7 +2267,43 @@ write(buffer: ArrayBuffer, callback: AsyncCallback\<number>): void
``` ```
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility'
var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION
rendererFlags: 1
}
var audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
var audioRenderer;
audio.createAudioRenderer(audioRendererOptions).then((data)=> {
audioRenderer = data;
console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
});
var bufferSize;
audioRenderer.getBufferSize().then((data)=> {
console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
});
console.info('Buffer size:'+bufferSize);
var context = featureAbility.getContext();
var path = await context.getCacheDir();
var filePath = path+"/StarWars10s-2C-48000-4SW.wav"
let ss = fileio.createStreamSync(filePath, 'r'); let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
ss.readSync(buf); ss.readSync(buf);
...@@ -2299,7 +2335,42 @@ write(buffer: ArrayBuffer): Promise\<number> ...@@ -2299,7 +2335,42 @@ write(buffer: ArrayBuffer): Promise\<number>
``` ```
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility'
var audioStreamInfo = {
samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels:audio.AudioChannel.CHANNEL_2,
sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
var audioRenderer;
audio.createAudioRenderer(audioRendererOptions).then((data) => {
audioRenderer = data;
console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
});
var bufferSize;
audioRenderer.getBufferSize().then((data) => {
console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
});
console.info('BufferSize: ' + bufferSize);
var context = featureAbility.getContext();
var path = await context.getCacheDir();
var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; var filePath = 'data/StarWars10s-2C-48000-4SW.wav';
let ss = fileio.createStreamSync(filePath, 'r'); let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
...@@ -2402,12 +2473,39 @@ getBufferSize(): Promise\<number> ...@@ -2402,12 +2473,39 @@ getBufferSize(): Promise\<number>
**示例:** **示例:**
``` ```
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
var audioStreamInfo = {
samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels:audio.AudioChannel.CHANNEL_2,
sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
var audioRenderer;
audio.createAudioRenderer(audioRendererOptions).then((data) => {
audioRenderer = data;
console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
});
var bufferSize; var bufferSize;
await audioRenderer.getBufferSize().then(async function (data) => { audioRenderer.getBufferSize().then((data) => {
console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize=data; bufferSize=data;
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
}); });
``` ```
...@@ -2600,7 +2698,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ...@@ -2600,7 +2698,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void
``` ```
audioRenderer.on('markReach', 1000, (position) => { audioRenderer.on('markReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
...@@ -2647,7 +2745,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ...@@ -2647,7 +2745,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void
``` ```
audioRenderer.on('periodReach', 1000, (position) => { audioRenderer.on('periodReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
...@@ -2881,13 +2979,35 @@ start(): Promise<void\> ...@@ -2881,13 +2979,35 @@ start(): Promise<void\>
**示例:** **示例:**
``` ```
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags = 1
}
var audioCapturer;
audio.createAudioCapturer(audioCapturerOptions).then((data) => {
audioCapturer = data;
console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message);
});
audioCapturer.start().then(() => { audioCapturer.start().then(() => {
console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: ---------START---------');
console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); console.info('AudioFrameworkRecLog: Capturer started: SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state);
console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); console.info('AudioFrameworkRecLog: Capturer started: SUCCESS ');
if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) {
stateFlag = true; console.info('AudioFrameworkRecLog: AudioCapturer is in Running State');
} }
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message);
...@@ -2940,15 +3060,13 @@ stop(): Promise<void\> ...@@ -2940,15 +3060,13 @@ stop(): Promise<void\>
``` ```
audioCapturer.stop().then(() => { audioCapturer.stop().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------STOP RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS');
if ((audioCapturer.state == audioCapturer.AudioState.STATE_STOPPED)){ if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){
stateFlag=true; console.info('AudioFrameworkRecLog: State is Stopped': ');
console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
} }
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
stateFlag=false;
}); });
``` ```
...@@ -3000,13 +3118,9 @@ audioCapturer.release().then(() => { ...@@ -3000,13 +3118,9 @@ audioCapturer.release().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
stateFlag=true;
console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag);
expect(stateFlag).assertTrue();
done();
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
stateFlag=false
}); });
``` ```
...@@ -3030,6 +3144,13 @@ read(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer\ ...@@ -3030,6 +3144,13 @@ read(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer\
**示例:** **示例:**
``` ```
var bufferSize;
audioCapturer.getBufferSize().then((data) => {
console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message);
});
audioCapturer.read(bufferSize, true, async(err, buffer) => { audioCapturer.read(bufferSize, true, async(err, buffer) => {
if (!err) { if (!err) {
console.log("Success in reading the buffer data"); console.log("Success in reading the buffer data");
...@@ -3062,6 +3183,14 @@ read(size: number, isBlockingRead: boolean): Promise<ArrayBuffer\> ...@@ -3062,6 +3183,14 @@ read(size: number, isBlockingRead: boolean): Promise<ArrayBuffer\>
**示例:** **示例:**
``` ```
var bufferSize;
audioCapturer.getBufferSize().then((data) => {
console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message);
});
console.info('Buffer size: ' + bufferSize);
audioCapturer.read(bufferSize, true).then((buffer) => { audioCapturer.read(bufferSize, true).then((buffer) => {
console.info('buffer read successfully'); console.info('buffer read successfully');
}).catch((err) => { }).catch((err) => {
...@@ -3165,15 +3294,12 @@ getBufferSize(): Promise<number\> ...@@ -3165,15 +3294,12 @@ getBufferSize(): Promise<number\>
**示例:** **示例:**
``` ```
audioCapturer.getBufferSize().then((bufferSize) => { var bufferSize;
if (!err) { audioCapturer.getBufferSize().then((data) => {
console.log('BufferSize : ' + bufferSize); console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data);
audioCapturer.read(bufferSize, true).then((buffer) => { bufferSize = data;
console.info('Buffer read is ' + buffer ); }).catch((err) => {
}).catch((err) => { console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message);
console.info('ERROR : '+err.message);
});
}
}); });
``` ```
...@@ -3198,7 +3324,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ...@@ -3198,7 +3324,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void
``` ```
audioCapturer.on('markReach', 1000, (position) => { audioCapturer.on('markReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
...@@ -3244,7 +3370,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ...@@ -3244,7 +3370,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void
``` ```
audioCapturer.on('periodReach', 1000, (position) => { audioCapturer.on('periodReach', 1000, (position) => {
if (position == "1000") { if (position == 1000) {
console.log('ON Triggered successfully'); console.log('ON Triggered successfully');
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册