Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
8f32e16b
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8f32e16b
编写于
7月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6878 js api doc compilation issues fixes
Merge pull request !6878 from rahulkumar/js-api-3.1-release
上级
a4c444db
3795b3a6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
316 addition
and
64 deletion
+316
-64
en/application-dev/reference/apis/js-apis-audio.md
en/application-dev/reference/apis/js-apis-audio.md
+158
-32
zh-cn/application-dev/reference/apis/js-apis-audio.md
zh-cn/application-dev/reference/apis/js-apis-audio.md
+158
-32
未找到文件。
en/application-dev/reference/apis/js-apis-audio.md
浏览文件 @
8f32e16b
...
...
@@ -2264,7 +2264,43 @@ Writes the buffer. This API uses an asynchronous callback to return the result.
```
import audio from '@ohos.multimedia.audio';
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 buf = new ArrayBuffer(bufferSize);
ss.readSync(buf);
...
...
@@ -2296,7 +2332,42 @@ Writes the buffer. This API uses a promise to return the result.
```
import audio from '@ohos.multimedia.audio';
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';
let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize);
...
...
@@ -2399,12 +2470,39 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**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;
a
wait audioRenderer.getBufferSize().then(async function
(data) => {
console.info('AudioFrameworkRenderLog: getBufferSize
:
SUCCESS '+data);
a
udioRenderer.getBufferSize().then(
(data) => {
console.info('AudioFrameworkRenderLog: getBufferSize
:
SUCCESS '+data);
bufferSize=data;
}).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
```
audioRenderer.on('markReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
@@ -2644,7 +2742,7 @@ Subscribes to period reached events. When the period of frame rendering reaches
```
audioRenderer.on('periodReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
@@ -2878,13 +2976,35 @@ Starts capturing. This API uses a promise to return the result.
**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(() => {
console.info('AudioFrameworkRecLog: ---------START---------');
console.info('AudioFrameworkRecLog: Capturer started
:SUCCESS
');
console.info('AudioFrameworkRecLog: AudioCapturer
: STATE
: '+audioCapturer.state);
console.info('AudioFrameworkRecLog: Capturer started
:
SUCCESS ');
console.info('AudioFrameworkRecLog: Capturer started
: SUCCESS
');
console.info('AudioFrameworkRecLog: AudioCapturer
: STATE
: '+audioCapturer.state);
console.info('AudioFrameworkRecLog: Capturer started
:
SUCCESS ');
if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) {
stateFlag = true
;
console.info('AudioFrameworkRecLog: AudioCapturer is in Running State')
;
}
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message);
...
...
@@ -2937,15 +3057,13 @@ Stops capturing. This API uses a promise to return the result.
```
audioCapturer.stop().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS');
if ((audioCapturer.state == audioCapturer.AudioState.STATE_STOPPED)){
stateFlag=true;
console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
console.info('AudioFrameworkRecLog: ---------STOP RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS');
if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){
console.info('AudioFrameworkRecLog: State is Stopped': ');
}
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
stateFlag=false;
console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
});
```
...
...
@@ -2997,13 +3115,9 @@ audioCapturer.release().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
stateFlag=true;
console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag);
expect(stateFlag).assertTrue();
done();
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
stateFlag=false
console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
});
```
...
...
@@ -3027,6 +3141,13 @@ Reads the buffer. This API uses an asynchronous callback to return the result.
**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) => {
if (!err) {
console.log("Success in reading the buffer data");
...
...
@@ -3059,6 +3180,14 @@ Reads the buffer. This API uses a promise to return the result.
**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) => {
console.info('buffer read successfully');
}).catch((err) => {
...
...
@@ -3162,15 +3291,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
**Example**
```
audioCapturer.getBufferSize().then((bufferSize) => {
if (!err) {
console.log('BufferSize : ' + bufferSize);
audioCapturer.read(bufferSize, true).then((buffer) => {
console.info('Buffer read is ' + buffer );
}).catch((err) => {
console.info('ERROR : '+err.message);
});
}
var bufferSize;
audioCapturer.getBufferSize().then((data) => {
console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message);
});
```
...
...
@@ -3195,7 +3321,7 @@ Subscribes to mark reached events. When the number of frames captured reaches th
```
audioCapturer.on('markReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
@@ -3241,7 +3367,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th
```
audioCapturer.on('periodReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
zh-cn/application-dev/reference/apis/js-apis-audio.md
浏览文件 @
8f32e16b
...
...
@@ -2267,7 +2267,43 @@ write(buffer: ArrayBuffer, callback: AsyncCallback\<number>): void
```
import audio from '@ohos.multimedia.audio';
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 buf = new ArrayBuffer(bufferSize);
ss.readSync(buf);
...
...
@@ -2299,7 +2335,42 @@ write(buffer: ArrayBuffer): Promise\<number>
```
import audio from '@ohos.multimedia.audio';
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';
let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize);
...
...
@@ -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;
a
wait audioRenderer.getBufferSize().then(async function
(data) => {
console.info('AudioFrameworkRenderLog: getBufferSize
:
SUCCESS '+data);
a
udioRenderer.getBufferSize().then(
(data) => {
console.info('AudioFrameworkRenderLog: getBufferSize
:
SUCCESS '+data);
bufferSize=data;
}).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
```
audioRenderer.on('markReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
@@ -2647,7 +2745,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void
```
audioRenderer.on('periodReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
@@ -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(() => {
console.info('AudioFrameworkRecLog: ---------START---------');
console.info('AudioFrameworkRecLog: Capturer started
:SUCCESS
');
console.info('AudioFrameworkRecLog: AudioCapturer
: STATE
: '+audioCapturer.state);
console.info('AudioFrameworkRecLog: Capturer started
:
SUCCESS ');
console.info('AudioFrameworkRecLog: Capturer started
: SUCCESS
');
console.info('AudioFrameworkRecLog: AudioCapturer
: STATE
: '+audioCapturer.state);
console.info('AudioFrameworkRecLog: Capturer started
:
SUCCESS ');
if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) {
stateFlag = true
;
console.info('AudioFrameworkRecLog: AudioCapturer is in Running State')
;
}
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message);
...
...
@@ -2940,15 +3060,13 @@ stop(): Promise<void\>
```
audioCapturer.stop().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS');
if ((audioCapturer.state == audioCapturer.AudioState.STATE_STOPPED)){
stateFlag=true;
console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
console.info('AudioFrameworkRecLog: ---------STOP RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS');
if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){
console.info('AudioFrameworkRecLog: State is Stopped': ');
}
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
stateFlag=false;
console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
});
```
...
...
@@ -3000,13 +3118,9 @@ audioCapturer.release().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
stateFlag=true;
console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag);
expect(stateFlag).assertTrue();
done();
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
stateFlag=false
console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
});
```
...
...
@@ -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) => {
if (!err) {
console.log("Success in reading the buffer data");
...
...
@@ -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) => {
console.info('buffer read successfully');
}).catch((err) => {
...
...
@@ -3165,15 +3294,12 @@ getBufferSize(): Promise<number\>
**示例:**
```
audioCapturer.getBufferSize().then((bufferSize) => {
if (!err) {
console.log('BufferSize : ' + bufferSize);
audioCapturer.read(bufferSize, true).then((buffer) => {
console.info('Buffer read is ' + buffer );
}).catch((err) => {
console.info('ERROR : '+err.message);
});
}
var bufferSize;
audioCapturer.getBufferSize().then((data) => {
console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data);
bufferSize = data;
}).catch((err) => {
console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message);
});
```
...
...
@@ -3198,7 +3324,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void
```
audioCapturer.on('markReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
@@ -3244,7 +3370,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void
```
audioCapturer.on('periodReach', 1000, (position) => {
if (position ==
"1000"
) {
if (position ==
1000
) {
console.log('ON Triggered successfully');
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录