Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
1632d97f
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1632d97f
编写于
6月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4955 js api doc compilation issue fix
Merge pull request !4955 from rahulkumar/doc_rahul_br
上级
66c4b6c6
987c488c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
47 addition
and
31 deletion
+47
-31
en/application-dev/reference/apis/js-apis-audio.md
en/application-dev/reference/apis/js-apis-audio.md
+47
-31
未找到文件。
en/application-dev/reference/apis/js-apis-audio.md
浏览文件 @
1632d97f
...
@@ -220,7 +220,7 @@ var audioCapturerOptions = {
...
@@ -220,7 +220,7 @@ var audioCapturerOptions = {
}
}
var audioCapturer;
var audioCapturer;
audio.createAudio
Rende
rer(audioCapturerOptions).then((data) => {
audio.createAudio
Captu
rer(audioCapturerOptions).then((data) => {
audioCapturer = data;
audioCapturer = data;
console.info('AudioCapturer Created : Success : Stream Type: SUCCESS');
console.info('AudioCapturer Created : Success : Stream Type: SUCCESS');
}).catch((err) => {
}).catch((err) => {
...
@@ -1334,7 +1334,7 @@ Sets a device to the active state. This API uses an asynchronous callback to ret
...
@@ -1334,7 +1334,7 @@ Sets a device to the active state. This API uses an asynchronous callback to ret
**Example:**
**Example:**
```
```
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err) => {
audioManager.setDeviceActive(audio.
Active
DeviceType.SPEAKER, true, (err) => {
if (err) {
if (err) {
console.error('Failed to set the active status of the device. ${err.message}');
console.error('Failed to set the active status of the device. ${err.message}');
return;
return;
...
@@ -1370,7 +1370,7 @@ Sets a device to the active state. This API uses a promise to return the result.
...
@@ -1370,7 +1370,7 @@ Sets a device to the active state. This API uses a promise to return the result.
**Example:**
**Example:**
```
```
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(() => {
audioManager.setDeviceActive(audio.
Active
DeviceType.SPEAKER, true).then(() => {
console.log('Promise returned to indicate that the device is set to the active status.');
console.log('Promise returned to indicate that the device is set to the active status.');
});
});
```
```
...
@@ -1394,7 +1394,7 @@ Checks whether a device is active. This API uses an asynchronous callback to ret
...
@@ -1394,7 +1394,7 @@ Checks whether a device is active. This API uses an asynchronous callback to ret
**Example:**
**Example:**
```
```
audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
audioManager.isDeviceActive(audio.
Active
DeviceType.SPEAKER, (err, value) => {
if (err) {
if (err) {
console.error('Failed to obtain the active status of the device. ${err.message}');
console.error('Failed to obtain the active status of the device. ${err.message}');
return;
return;
...
@@ -1427,7 +1427,7 @@ Checks whether a device is active. This API uses a promise to return the query r
...
@@ -1427,7 +1427,7 @@ Checks whether a device is active. This API uses a promise to return the query r
**Example:**
**Example:**
```
```
audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) => {
audioManager.isDeviceActive(audio.
Active
DeviceType.SPEAKER).then((value) => {
console.log('Promise returned to indicate that the active status of the device is obtained.' + value);
console.log('Promise returned to indicate that the active status of the device is obtained.' + value);
});
});
```
```
...
@@ -1674,7 +1674,7 @@ var interAudioInterrupt = {
...
@@ -1674,7 +1674,7 @@ var interAudioInterrupt = {
contentType:0,
contentType:0,
pauseWhenDucked:true
pauseWhenDucked:true
};
};
this.
audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => {
audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => {
if (InterruptAction.actionType === 0) {
if (InterruptAction.actionType === 0) {
console.log("An event to gain the audio focus starts.");
console.log("An event to gain the audio focus starts.");
console.log("Focus gain event:" + JSON.stringify(InterruptAction));
console.log("Focus gain event:" + JSON.stringify(InterruptAction));
...
@@ -1712,7 +1712,7 @@ var interAudioInterrupt = {
...
@@ -1712,7 +1712,7 @@ var interAudioInterrupt = {
contentType:0,
contentType:0,
pauseWhenDucked:true
pauseWhenDucked:true
};
};
this.
audioManager.off('interrupt', interAudioInterrupt, (InterruptAction) => {
audioManager.off('interrupt', interAudioInterrupt, (InterruptAction) => {
if (InterruptAction.actionType === 0) {
if (InterruptAction.actionType === 0) {
console.log("An event to release the audio focus starts.");
console.log("An event to release the audio focus starts.");
console.log("Focus release event:" + JSON.stringify(InterruptAction));
console.log("Focus release event:" + JSON.stringify(InterruptAction));
...
@@ -1778,7 +1778,7 @@ This is a system API and cannot be called by third-party applications.
...
@@ -1778,7 +1778,7 @@ This is a system API and cannot be called by third-party applications.
**Example:**
**Example:**
```
```
audioManager.setAudioScene(audio.AudioScene
Mode
.AUDIO_SCENE_PHONE_CALL).then(() => {
audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL).then(() => {
console.log('Promise returned to indicate a successful setting of the audio scene mode.');
console.log('Promise returned to indicate a successful setting of the audio scene mode.');
}).catch ((err) => {
}).catch ((err) => {
console.log('Failed to set the audio scene mode');
console.log('Failed to set the audio scene mode');
...
@@ -1947,6 +1947,7 @@ Obtains the renderer information provided while creating a renderer instance. Th
...
@@ -1947,6 +1947,7 @@ Obtains the renderer information provided while creating a renderer instance. Th
**Example:**
**Example:**
```
```
var resultFlag = true;
audioRenderer.getRendererInfo().then((rendererInfo) => {
audioRenderer.getRendererInfo().then((rendererInfo) => {
console.log('Renderer GetRendererInfo:');
console.log('Renderer GetRendererInfo:');
console.log('Renderer content:' + rendererInfo.content);
console.log('Renderer content:' + rendererInfo.content);
...
@@ -2404,13 +2405,11 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
...
@@ -2404,13 +2405,11 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**Example:**
**Example:**
```
```
audioRenderer.getBufferSize(
(err, bufferSize) => {
var bufferSize = audioRenderer.getBufferSize(async
(err, bufferSize) => {
if (err) {
if (err) {
console.error('getBufferSize error');
console.error('getBufferSize error');
}
}
});
});
let buf = new ArrayBuffer(bufferSize);
ss.readSync(buf);
```
```
...
@@ -2431,11 +2430,12 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
...
@@ -2431,11 +2430,12 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**Example:**
**Example:**
```
```
audioRenderer.getBufferSize().then((bufferSize) => {
var bufferSize;
let buf = new ArrayBuffer(bufferSize);
await audioRenderer.getBufferSize().then(async function (data) => {
ss.readSync(buf);
console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data);
bufferSize=data;
}).catch((err) => {
}).catch((err) => {
console.
log('ERROR
: '+err.message);
console.
info('AudioFrameworkRenderLog: getBufferSize :ERROR
: '+err.message);
});
});
```
```
...
@@ -2563,7 +2563,9 @@ Subscribes to audio interrupt events. This API uses a callback to get interrupt
...
@@ -2563,7 +2563,9 @@ Subscribes to audio interrupt events. This API uses a callback to get interrupt
**Example:**
**Example:**
```
```
audioRenderer.on('interrupt', (interruptEvent) => {
var isPlay;
var started;
audioRenderer.on('interrupt', async(interruptEvent) => {
if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) {
if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) {
switch (interruptEvent.hintType) {
switch (interruptEvent.hintType) {
case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
...
@@ -2579,11 +2581,30 @@ audioRenderer.on('interrupt', (interruptEvent) => {
...
@@ -2579,11 +2581,30 @@ audioRenderer.on('interrupt', (interruptEvent) => {
switch (interruptEvent.hintType) {
switch (interruptEvent.hintType) {
case audio.InterruptHint.INTERRUPT_HINT_RESUME:
case audio.InterruptHint.INTERRUPT_HINT_RESUME:
console.log('Resume force paused renderer or ignore');
console.log('Resume force paused renderer or ignore');
startRenderer();
await audioRenderer.start().then(async function () {
console.info('AudioInterruptMusic: renderInstant started :SUCCESS ');
started = true;
}).catch((err) => {
console.info('AudioInterruptMusic: renderInstant start :ERROR : '+err.message);
started = false;
});
if (started) {
isPlay = true;
console.info('AudioInterruptMusic Renderer started : isPlay : '+isPlay);
} else {
console.error('AudioInterruptMusic Renderer start failed');
}
break;
break;
case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
console.log('Choose to pause or ignore');
console.log('Choose to pause or ignore');
pauseRenderer();
if (isPlay == true) {
isPlay == false;
console.info('AudioInterruptMusic: Media PAUSE : TRUE');
}
else {
isPlay = true;
console.info('AudioInterruptMusic: Media PLAY : TRUE');
}
break;
break;
}
}
}
}
...
@@ -2959,7 +2980,7 @@ Stops capturing. This API uses a promise to return the result.
...
@@ -2959,7 +2980,7 @@ 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: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS');
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS');
if ((audioCapturer.state == audio
Capturer
.AudioState.STATE_STOPPED)){
if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){
stateFlag=true;
stateFlag=true;
console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
}
}
...
@@ -3021,8 +3042,6 @@ audioCapturer.release().then(() => {
...
@@ -3021,8 +3042,6 @@ audioCapturer.release().then(() => {
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
stateFlag=true;
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
stateFlag=false
...
@@ -3187,15 +3206,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
...
@@ -3187,15 +3206,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
**Example:**
**Example:**
```
```
audioCapturer.getBufferSize().then((bufferSize) => {
await audioCapturer.getBufferSize().then(async function (bufferSize) {
if (!err) {
console.info('AudioFrameworkRecordLog: getBufferSize :SUCCESS '+ bufferSize);
console.log('BufferSize : ' + bufferSize);
var buffer = await audioCapturer.read(bufferSize, true);
audioCapturer.read(bufferSize, true).then((buffer) => {
console.info('Buffer read is ' + buffer );
console.info('Buffer read is ' + buffer );
}).catch((err) => {
}).catch((err) => {
console.info('ERROR : '+err.message);
console.info('AudioFrameworkRecordLog: getBufferSize :ERROR : '+err.message);
});
}
});
});
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录