Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
eb764bc3
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
提交
eb764bc3
编写于
7月 19, 2023
作者:
W
wangzx0705
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify md doc format
Signed-off-by:
N
wangzx0705
<
wangzx0705@thundersoft.com
>
上级
f5d82986
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
81 addition
and
29 deletion
+81
-29
zh-cn/application-dev/reference/apis/js-apis-audio.md
zh-cn/application-dev/reference/apis/js-apis-audio.md
+81
-29
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-audio.md
浏览文件 @
eb764bc3
...
@@ -3000,8 +3000,8 @@ isVolumeUnadjustable(): boolean
...
@@ -3000,8 +3000,8 @@ isVolumeUnadjustable(): boolean
**示例:**
**示例:**
```
js
```
js
bool
s
witch
=
audioVolumeGroupManager
.
isVolumeUnadjustable
();
bool
volumeAdjustS
witch
=
audioVolumeGroupManager
.
isVolumeUnadjustable
();
console
.
info
(
`Whether it is volume unadjustable:
${
s
witch
}
.`
);
console
.
info
(
`Whether it is volume unadjustable:
${
volumeAdjustS
witch
}
.`
);
```
```
### adjustVolumeByStep<sup>10+</sup>
### adjustVolumeByStep<sup>10+</sup>
...
@@ -3025,6 +3025,15 @@ adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback<void
...
@@ -3025,6 +3025,15 @@ adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback<void
| adjustType |
[
VolumeAdjustType
](
#volumeadjusttype10
)
| 是 | 音量调节方向。 |
| adjustType |
[
VolumeAdjustType
](
#volumeadjusttype10
)
| 是 | 音量调节方向。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调表示成功还是失败。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调表示成功还是失败。 |
**错误码:**
以下错误码的详细介绍请参见
[
音频错误码
](
../errorcodes/errorcode-audio.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error |
| 6800301 | System error |
**示例:**
**示例:**
```
js
```
js
...
@@ -3063,6 +3072,15 @@ adjustVolumeByStep(adjustType: VolumeAdjustType): Promise<void>
...
@@ -3063,6 +3072,15 @@ adjustVolumeByStep(adjustType: VolumeAdjustType): Promise<void>
| ------------------- | ----------------------------- |
| ------------------- | ----------------------------- |
| Promise
<
void
>
| Promise回调表示成功还是失败。 |
| Promise
<
void
>
| Promise回调表示成功还是失败。 |
**错误码:**
以下错误码的详细介绍请参见
[
音频错误码
](
../errorcodes/errorcode-audio.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error |
| 6800301 | System error |
**示例:**
**示例:**
```
js
```
js
...
@@ -3095,6 +3113,15 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy
...
@@ -3095,6 +3113,15 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy
| adjustType |
[
VolumeAdjustType
](
#volumeadjusttype10
)
| 是 | 音量调节方向。 |
| adjustType |
[
VolumeAdjustType
](
#volumeadjusttype10
)
| 是 | 音量调节方向。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调表示成功还是失败。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调表示成功还是失败。 |
**错误码:**
以下错误码的详细介绍请参见
[
音频错误码
](
../errorcodes/errorcode-audio.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error |
| 6800301 | System error |
**示例:**
**示例:**
```
js
```
js
...
@@ -3133,6 +3160,15 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy
...
@@ -3133,6 +3160,15 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy
| ------------------- | ----------------------------- |
| ------------------- | ----------------------------- |
| Promise
<
void
>
| Promise回调表示成功还是失败。 |
| Promise
<
void
>
| Promise回调表示成功还是失败。 |
**错误码:**
以下错误码的详细介绍请参见
[
音频错误码
](
../errorcodes/errorcode-audio.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error |
| 6800301 | System error |
**示例:**
**示例:**
```
js
```
js
...
@@ -3160,7 +3196,16 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De
...
@@ -3160,7 +3196,16 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De
| volumeType |
[
AudioVolumeType
](
#audiovolumetype
)
| 是 | 音量流类型。 |
| volumeType |
[
AudioVolumeType
](
#audiovolumetype
)
| 是 | 音量流类型。 |
| volumeLevel | number | 是 | 音量等级。 |
| volumeLevel | number | 是 | 音量等级。 |
| device |
[
DeviceType
](
#devicetype
)
| 是 | 设备类型。 |
| device |
[
DeviceType
](
#devicetype
)
| 是 | 设备类型。 |
| callback | AsyncCallback
<
number
>
| 是 | 回调返回对应的音量增益DB值。 |
| callback | AsyncCallback
<
number
>
| 是 | 回调返回对应的音量增益dB值。 |
**错误码:**
以下错误码的详细介绍请参见
[
音频错误码
](
../errorcodes/errorcode-audio.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error |
| 6800301 | System error |
**示例:**
**示例:**
...
@@ -3177,7 +3222,7 @@ audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, audi
...
@@ -3177,7 +3222,7 @@ audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, audi
getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): Promise
<
number
>
getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): Promise
<
number
>
获取音量增益
D
B值,使用Promise方式异步返回结果。
获取音量增益
d
B值,使用Promise方式异步返回结果。
**系统接口:**
该接口为系统接口
**系统接口:**
该接口为系统接口
...
@@ -3195,7 +3240,16 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De
...
@@ -3195,7 +3240,16 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ---------------------------------- |
| --------------------- | ---------------------------------- |
| Promise
<
number
>
| Promise回调返回对应的音量增益DB值。 |
| Promise
<
number
>
| Promise回调返回对应的音量增益dB值。 |
**错误码:**
以下错误码的详细介绍请参见
[
音频错误码
](
../errorcodes/errorcode-audio.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error |
| 6800301 | System error |
**示例:**
**示例:**
...
@@ -5520,7 +5574,7 @@ getMinStreamVolume(): Promise<number>
...
@@ -5520,7 +5574,7 @@ getMinStreamVolume(): Promise<number>
**示例:**
**示例:**
```
js
```
js
audioRenderer
.
getMinStreamVolume
().
then
(
value
=>
{
audioRenderer
.
getMinStreamVolume
().
then
(
(
value
)
=>
{
console
.
info
(
`Get min stream volume Success!
${
value
}
`
);
console
.
info
(
`Get min stream volume Success!
${
value
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Get min stream volume Fail:
${
err
}
`
);
console
.
error
(
`Get min stream volume Fail:
${
err
}
`
);
...
@@ -5569,7 +5623,7 @@ getMaxStreamVolume(): Promise<number>
...
@@ -5569,7 +5623,7 @@ getMaxStreamVolume(): Promise<number>
**示例:**
**示例:**
```
js
```
js
audioRenderer
.
getMaxStreamVolume
().
then
(
value
=>
{
audioRenderer
.
getMaxStreamVolume
().
then
(
(
value
)
=>
{
console
.
info
(
`Get max stream volume Success!
${
value
}
`
);
console
.
info
(
`Get max stream volume Success!
${
value
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Get max stream volume Fail:
${
err
}
`
);
console
.
error
(
`Get max stream volume Fail:
${
err
}
`
);
...
@@ -5618,7 +5672,7 @@ getUnderflowCount(): Promise<number>
...
@@ -5618,7 +5672,7 @@ getUnderflowCount(): Promise<number>
**示例:**
**示例:**
```
js
```
js
audioRenderer
.
getUnderflowCount
().
then
(
value
=>
{
audioRenderer
.
getUnderflowCount
().
then
(
(
value
)
=>
{
console
.
info
(
`Get underflow count Success!
${
value
}
`
);
console
.
info
(
`Get underflow count Success!
${
value
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Get underflow count Fail:
${
err
}
`
);
console
.
error
(
`Get underflow count Fail:
${
err
}
`
);
...
@@ -5669,12 +5723,12 @@ getCurrentOutputDevices(): Promise<AudioDeviceDescriptors>
...
@@ -5669,12 +5723,12 @@ getCurrentOutputDevices(): Promise<AudioDeviceDescriptors>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------- | ----------------------------- |
| ------------------- | ----------------------------- |
| Promise
<
AudioDeviceDescriptors
>
| Promise回调返回音频流的输出设备描述
符。
|
| Promise
<
AudioDeviceDescriptors
>
| Promise回调返回音频流的输出设备描述
信息
|
**示例:**
**示例:**
```
js
```
js
audioRenderer
.
getCurrentOutputDevices
().
then
(
deviceInfo
=>
{
audioRenderer
.
getCurrentOutputDevices
().
then
(
(
deviceInfo
)
=>
{
console
.
info
(
`DeviceInfo id:
${
deviceInfo
.
id
}
`
);
console
.
info
(
`DeviceInfo id:
${
deviceInfo
.
id
}
`
);
console
.
info
(
`DeviceInfo type:
${
descriptor
.
deviceType
}
`
);
console
.
info
(
`DeviceInfo type:
${
descriptor
.
deviceType
}
`
);
console
.
info
(
`DeviceInfo role:
${
descriptor
.
deviceRole
}
`
);
console
.
info
(
`DeviceInfo role:
${
descriptor
.
deviceRole
}
`
);
...
@@ -5925,7 +5979,6 @@ on(type: 'outputDeviceChange', callback: Callback<AudioDeviceDescriptors\>): voi
...
@@ -5925,7 +5979,6 @@ on(type: 'outputDeviceChange', callback: Callback<AudioDeviceDescriptors\>): voi
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| ------- | --------------------------------------------|
| 401 | if input parameter type or number mismatch |
| 6800101 | if input parameter value error |
| 6800101 | if input parameter value error |
**示例:**
**示例:**
...
@@ -5958,7 +6011,6 @@ off(type: 'outputDeviceChange', callback?: Callback<AudioDeviceDescriptors\>): v
...
@@ -5958,7 +6011,6 @@ off(type: 'outputDeviceChange', callback?: Callback<AudioDeviceDescriptors\>): v
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| ------- | --------------------------------------------|
| 401 | if input parameter type or number mismatch |
| 6800101 | if input parameter value error |
| 6800101 | if input parameter value error |
**示例:**
**示例:**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录