未验证 提交 85087aaa 编写于 作者: O openharmony_ci 提交者: Gitee

!21128 getAudioEffectInfoArray接口说明修改

Merge pull request !21128 from yaojingyu2008/master
......@@ -91,7 +91,7 @@
## 全局查询音效模式
主要包括全局音效查询相应ContentType和StreamUsage对应场景的音效模式。
主要包括全局音效查询相应StreamUsage对应场景的音效模式。
对于播放音频类的应用,开发者需要关注该应用的音频流使用什么音效模式并做出相应的操作,比如音乐App播放时,应选择音乐场景下的模式。在使用查询接口前,开发者需要使用getStreamManager()创建一个AudioStreamManager音频流管理实例。
### 获取音频流管理接口
......@@ -107,7 +107,7 @@
### 查询对应场景的音效模式
```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
audioStreamManager.getAudioEffectInfoArray(audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
if (err) {
console.error('Failed to get effect info array');
return;
......
......@@ -3708,7 +3708,7 @@ audioStreamManager.isActive(audio.AudioVolumeType.MEDIA).then((value) => {
### getAudioEffectInfoArray<sup>10+</sup>
getAudioEffectInfoArray(content: ContentType, usage: StreamUsage, callback: AsyncCallback&lt;AudioEffectInfoArray&gt;): void
getAudioEffectInfoArray(usage: StreamUsage, callback: AsyncCallback&lt;AudioEffectInfoArray&gt;): void
获取当前音效模式的信息。使用callback异步回调。
......@@ -3718,14 +3718,21 @@ getAudioEffectInfoArray(content: ContentType, usage: StreamUsage, callback: Asyn
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | -------- | --------------------------- |
| content | [ContentType](#contenttype) | 是 | 音频内容类型。 |
| usage | [StreamUsage](#streamusage) | 是 | 音频流使用类型。 |
| callback | AsyncCallback<[AudioEffectInfoArray](#audioeffectinfoarray10)> | 是 | 回调函数,返回当前音效模式的信息。|
**错误码:**
以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error. Return by callback.|
**示例:**
```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
audioStreamManager.getAudioEffectInfoArray(audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
console.info('getAudioEffectInfoArray **** Get Callback Called ****');
if (err) {
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
......@@ -3738,7 +3745,7 @@ audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC,
### getAudioEffectInfoArray<sup>10+</sup>
getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise&lt;AudioEffectInfoArray&gt;
getAudioEffectInfoArray(usage: StreamUsage): Promise&lt;AudioEffectInfoArray&gt;
获取当前音效模式的信息。使用Promise异步回调。
......@@ -3748,7 +3755,6 @@ getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise&lt;Au
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | -------- | --------------------------- |
| content | [ContentType](#contenttype) | 是 | 音频内容类型。 |
| usage | [StreamUsage](#streamusage) | 是 | 音频流使用类型。 |
**返回值:**
......@@ -3757,10 +3763,18 @@ getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise&lt;Au
| --------------------------------------------------------------------------| --------------------------------------- |
| Promise<[AudioEffectInfoArray](#audioeffectinfoarray10)> | Promise对象,返回当前音效模式的信息。 |
**错误码:**
以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 6800101 | Invalid parameter error. Return by promise. |
**示例:**
```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA).then((audioEffectInfoArray) => {
audioStreamManager.getAudioEffectInfoArray(audio.StreamUsage.STREAM_USAGE_MEDIA).then((audioEffectInfoArray) => {
console.info('getAudioEffectInfoArray ######### Get Promise is called ##########');
console.info(`The effect modes are: ${audioEffectInfoArray}`);
}).catch((err) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册