Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
a21c92af
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,发现更多精彩内容 >>
未验证
提交
a21c92af
编写于
3月 14, 2022
作者:
A
AOL
提交者:
Gitee
3月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix promise function example issues
Signed-off-by:
N
magekkkk
<
lixin113@huawei.com
>
上级
447fd830
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
34 deletion
+34
-34
zh-cn/application-dev/reference/apis/js-apis-audio.md
zh-cn/application-dev/reference/apis/js-apis-audio.md
+34
-34
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-audio.md
浏览文件 @
a21c92af
...
@@ -422,9 +422,9 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>
...
@@ -422,9 +422,9 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(()
=>
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(()
=> {
console.log('Promise returned to indicate a successful volume setting.');
console.log('Promise returned to indicate a successful volume setting.');
)
}
)
```
```
### getVolume
### getVolume
...
@@ -479,9 +479,9 @@ getVolume(volumeType: AudioVolumeType): Promise<number>
...
@@ -479,9 +479,9 @@ getVolume(volumeType: AudioVolumeType): Promise<number>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) =>
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) =>
{
console.log('Promise returned to indicate that the volume is obtained.' + value);
console.log('Promise returned to indicate that the volume is obtained.' + value);
)
}
)
```
```
### getMinVolume
### getMinVolume
...
@@ -536,9 +536,9 @@ getMinVolume(volumeType: AudioVolumeType): Promise<number>
...
@@ -536,9 +536,9 @@ getMinVolume(volumeType: AudioVolumeType): Promise<number>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) =>
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) =>
{
console.log('Promised returned to indicate that the minimum volume is obtained.' + value);
console.log('Promised returned to indicate that the minimum volume is obtained.' + value);
)
}
)
```
```
### getMaxVolume
### getMaxVolume
...
@@ -593,9 +593,9 @@ getMaxVolume(volumeType: AudioVolumeType): Promise<number>
...
@@ -593,9 +593,9 @@ getMaxVolume(volumeType: AudioVolumeType): Promise<number>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)
=>
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)
=> {
console.log('Promised returned to indicate that the maximum volume is obtained.');
console.log('Promised returned to indicate that the maximum volume is obtained.');
)
}
)
```
```
### mute
### mute
...
@@ -653,9 +653,9 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>
...
@@ -653,9 +653,9 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() =>
audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() =>
{
console.log('Promise returned to indicate that the stream is muted.');
console.log('Promise returned to indicate that the stream is muted.');
)
}
)
```
```
...
@@ -712,9 +712,9 @@ isMute(volumeType: AudioVolumeType): Promise<boolean>
...
@@ -712,9 +712,9 @@ isMute(volumeType: AudioVolumeType): Promise<boolean>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) =>
audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) =>
{
console.log('Promise returned to indicate that the mute status of the stream is obtained.' + value);
console.log('Promise returned to indicate that the mute status of the stream is obtained.' + value);
)
}
)
```
```
### isActive
### isActive
...
@@ -769,9 +769,9 @@ isActive(volumeType: AudioVolumeType): Promise<boolean>
...
@@ -769,9 +769,9 @@ isActive(volumeType: AudioVolumeType): Promise<boolean>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) =>
audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) =>
{
console.log('Promise returned to indicate that the active status of the stream is obtained.' + value);
console.log('Promise returned to indicate that the active status of the stream is obtained.' + value);
)
}
)
```
```
### setRingerMode
### setRingerMode
...
@@ -826,9 +826,9 @@ setRingerMode(mode: AudioRingMode): Promise<void>
...
@@ -826,9 +826,9 @@ setRingerMode(mode: AudioRingMode): Promise<void>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() =>
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() =>
{
console.log('Promise returned to indicate a successful setting of the ringer mode.');
console.log('Promise returned to indicate a successful setting of the ringer mode.');
)
}
)
```
```
...
@@ -878,9 +878,9 @@ getRingerMode(): Promise<AudioRingMode>
...
@@ -878,9 +878,9 @@ getRingerMode(): Promise<AudioRingMode>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getRingerMode().then((value) =>
audioManager.getRingerMode().then((value) =>
{
console.log('Promise returned to indicate that the ringer mode is obtained.' + value);
console.log('Promise returned to indicate that the ringer mode is obtained.' + value);
)
}
)
```
```
### setAudioParameter
### setAudioParameter
...
@@ -937,9 +937,9 @@ setAudioParameter(key: string, value: string): Promise<void>
...
@@ -937,9 +937,9 @@ setAudioParameter(key: string, value: string): Promise<void>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.setAudioParameter('PBits per sample', '8 bit').then(() =>
audioManager.setAudioParameter('PBits per sample', '8 bit').then(() =>
{
console.log('Promise returned to indicate a successful setting of the audio parameter.');
console.log('Promise returned to indicate a successful setting of the audio parameter.');
)
}
)
```
```
### getAudioParameter
### getAudioParameter
...
@@ -994,9 +994,9 @@ getAudioParameter(key: string): Promise<string>
...
@@ -994,9 +994,9 @@ getAudioParameter(key: string): Promise<string>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getAudioParameter('PBits per sample').then((value) =>
audioManager.getAudioParameter('PBits per sample').then((value) =>
{
console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value);
console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value);
)
}
)
```
```
### getDevices
### getDevices
...
@@ -1017,7 +1017,7 @@ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescrip
...
@@ -1017,7 +1017,7 @@ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescrip
**示例:**
**示例:**
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)
=>
{
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)
=>
{
if (err) {
if (err) {
console.error('Failed to obtain the device list. ${err.message}');
console.error('Failed to obtain the device list. ${err.message}');
return;
return;
...
@@ -1050,9 +1050,9 @@ getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>
...
@@ -1050,9 +1050,9 @@ getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)
=>
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)
=> {
console.log('Promise returned to indicate that the device list is obtained.');
console.log('Promise returned to indicate that the device list is obtained.');
)
}
)
```
```
### setDeviceActive
### setDeviceActive
...
@@ -1075,7 +1075,7 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCa
...
@@ -1075,7 +1075,7 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCa
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
audioManager.setDeviceActive(audio.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;
...
@@ -1110,9 +1110,9 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void&
...
@@ -1110,9 +1110,9 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void&
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()
=>
audioManager.setDeviceActive(audio.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.');
)
}
)
```
```
### isDeviceActive
### isDeviceActive
...
@@ -1168,9 +1168,9 @@ isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean>
...
@@ -1168,9 +1168,9 @@ isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) =>
audioManager.isDeviceActive(audio.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);
)
}
)
```
```
### setMicrophoneMute
### setMicrophoneMute
...
@@ -1225,9 +1225,9 @@ setMicrophoneMute(mute: boolean): Promise<void>
...
@@ -1225,9 +1225,9 @@ setMicrophoneMute(mute: boolean): Promise<void>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.setMicrophoneMute(true).then(() =>
audioManager.setMicrophoneMute(true).then(() =>
{
console.log('Promise returned to indicate that the microphone is muted.');
console.log('Promise returned to indicate that the microphone is muted.');
)
}
)
```
```
### isMicrophoneMute
### isMicrophoneMute
...
@@ -1276,9 +1276,9 @@ isMicrophoneMute(): Promise<boolean>
...
@@ -1276,9 +1276,9 @@ isMicrophoneMute(): Promise<boolean>
```
```
var audioManager = audio.getAudioManager();
var audioManager = audio.getAudioManager();
audioManager.isMicrophoneMute().then((value) =>
audioManager.isMicrophoneMute().then((value) =>
{
console.log('Promise returned to indicate that the mute status of the microphone is obtained.', + value);
console.log('Promise returned to indicate that the mute status of the microphone is obtained.', + value);
)
}
)
```
```
### on('volumeChange')
### on('volumeChange')
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录