diff --git a/en/application-dev/media/Readme-EN.md b/en/application-dev/media/Readme-EN.md index 1ffa6f76d57a7ee26a9b65c964aafc7e4e218b00..3c25a2ca04eb201b80a6e77dfa43aca310116b0a 100755 --- a/en/application-dev/media/Readme-EN.md +++ b/en/application-dev/media/Readme-EN.md @@ -8,12 +8,10 @@ - [Audio Playback Development Using AudioRenderer](audio-renderer.md) - - [Audio Management Development](audio-management.md) - - [Audio Recording Development](audio-recorder.md) - [Audio Recorder Development Using AudioCapturer](audio-capturer) -- Video +- Video - [Video Playback Development](video-playback.md) diff --git a/en/application-dev/media/audio-management.md b/en/application-dev/media/audio-management.md deleted file mode 100644 index db344ecdd7e78f7fa42775636732cf55543090ea..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-management.md +++ /dev/null @@ -1,394 +0,0 @@ -# Audio Management Development - -## When to Use - -You use audio management APIs to set and obtain volume, and get information about input/output devices. - -## Available APIs - -**Table 1** APIs for audio management - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

API

-

Description

-

getAudioManager(): AudioManager

-

Obtains an AudioManager instance.

-

AudioManager

-

Manages audio volume and audio device information. For details, see AudioManager.

-

AudioDeviceDescriptor

-

Describes audio devices.

-

AudioVolumeType

-

Enumerates audio volume types.

-

DeviceFlag

-

Enumerates flags of supported devices.

-

DeviceRole

-

Enumerates device roles.

-

DeviceType

-

Enumerates device types.

-

AudioScene

-

Enumerates audio scenes.

-
- -**Table 2** AudioManager methods - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Method

-

Description

-

setVolume(audioType: AudioVolumeType,volume: number,callback: AsyncCallback<void>): void

-

Sets the volume of a stream asynchronously and uses a callback to return the execution result.

-

setVolume(audioType: AudioVolumeType,volume: number): Promise<void>

-

Sets the volume of a stream asynchronously and uses a Promise to return the execution result.

-

getVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void

-

Obtains the volume of a stream asynchronously and uses a callback to return the result.

-

getVolume(audioType: AudioVolumeType): Promise<number>

-

Obtains the volume of a stream asynchronously and uses a Promise to return the result.

-

getMinVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void

-

Obtains the minimum volume of a stream asynchronously and uses a callback to return the result.

-

getMinVolume(audioType: AudioVolumeType): Promise<number>

-

Obtains the minimum volume of a stream asynchronously and uses a Promise to return the result.

-

getMaxVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void

-

Obtains the maximum volume of a stream asynchronously and uses a callback to return the result.

-

getMaxVolume(audioType: AudioVolumeType): Promise<number>

-

Obtains the maximum volume of a stream asynchronously and uses a Promise to return the result.

-

getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void

-

Obtains the device list asynchronously and uses a callback to return the result.

-

getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>

-

Obtains the device list asynchronously and uses a Promise to return the result.

-

setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void>): void

-

Activates the device asynchronously and uses a callback to return the execution result.

-

setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void>

-

Activates the device asynchronously and uses a Promise to return the execution result.

-

isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean>): void

-

Checks whether a device is active asynchronously and uses a callback to return the result.

-

isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean>

-

Checks whether a device is active asynchronously and uses a Promise to return the result.

-

on(type: 'deviceChange', callback: AsyncCallback<DeviceChangeAction>): void

-

Subscribes to device change events. Registered clients will receieve the callback when a device is connected/disconnected.

-

setAudioScene(scene: AudioScene, callback: AsyncCallback<void>): void

-

Sets the audio scene mode asynchronously and uses a callback to return the execution result.

-

setAudioScene(scene: AudioScene): Promise<void>

-

Sets the audio scene mode asynchronously and uses a Promise to return the execution result.

-

getAudioScene(callback: AsyncCallback<AudioScene>): void

-

Obtains the audio scene mode asynchronously and uses a callback to return the result.

-

getAudioScene(): Promise<AudioScene>

-

Obtains the audio scene mode asynchronously and uses a Promise to return the result.

-
- -**Table 3** AudioDeviceDescriptor attributes - - - - - - - - - - - - - -

Parameter

-

Description

-

deviceRole: DeviceRole

-

Audio device role

-

deviceType: DeviceType

-

Audio device type

-
- -**Table 4** AudioVolumeType enums - - - - - - - - - - - - - - - - - - - - -

Enum

-

Description

-

VOICE_CALL = 0

-

Audio streams for voice calls

-

MEDIA = 1

-

Audio streams for media purpose

-

RINGTONE = 2

-

Audio streams for ring tones

-

VOICE_ASSISTANT = 9

-

Audio streams for voice assistant

-
- -**Table 5** DeviceFlag enums - - - - - - - - - - - - - - - - -

Enum

-

Description

-

OUTPUT_DEVICES_FLAG = 1

-

Output devices

-

INPUT_DEVICES_FLAG = 2

-

Input devices

-

ALL_DEVICES_FLAG = 3

-

All devices

-
- -**Table 6** DeviceRole enums - - - - - - - - - - - - - -

Enum

-

Description

-

INPUT_DEVICE = 1

-

Input role

-

OUTPUT_DEVICE = 2

-

Output role

-
- -**Table 7** DeviceType enums - - - - - - - - - - - - - - - - - - - - - - - - - -

Enum

-

Description

-

INVALID = 0

-

Invalid device

-

SPEAKER = 2

-

Speaker

-

WIRED_HEADSET = 3

-

Wired headset

-

BLUETOOTH_SCO = 7

-

Bluetooth device using the synchronous connection oriented (SCO) link

-

BLUETOOTH_A2DP = 8

-

Bluetooth device using advanced audio distribution profile (A2DP)

-

MIC = 15

-

Microphone

-
- -**Table 8** AudioScene enums - -Enumerates audio scenes. - -| Name | Description | -| :----------------------------- | :---------------------------- | -| AUDIO_SCENE_DEFAULT = 0 | Default audio scene.
| -| AUDIO_SCENE_RINGING = 1 | Ringing audio scene.
| -| AUDIO_SCENE_PHONE_CALL = 2 | Phone call audio scene.
| -| AUDIO_SCENE_VOICE_CHAT = 3 | Voice chat audio scene.
| - - -## Development Procedure - -1. Obtain an audio manager. - - ``` - const audioManager = audio.getAudioManager(); - ``` - -2. Obtain the audio stream volume. - - ``` - audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { - if (err) { - console.error(`failed to get volume ${err.message}`); - return; - } - console.log(`Media getVolume ${value}`); - }); - ``` - -## Usage - -**setAudioScene** - -**Example** - -Here's an example of how to use setAudioScene to change the audio strategy for the phone call scene. - -1. Obtain an audio manager. - - ``` - const audioManager = audio.getAudioManager(); - ``` - -2. Change the audio scene to phone call. - - ``` - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL, (err) => { - if (err) { - console.error('Failed to set the audio scene mode.​ ${err.message}'); - return; - } - console.log('Audio scene mode setting is successful.'); - }); - ``` - -**getAudioScene** - -**Example** - -Here's an example of how to use getAudioScene to obtain the current audio scene. - -1. Obtain an audio manager. - - ``` - const audioManager = audio.getAudioManager(); - ``` - -2. Obtain the current audio scene. - - ``` - audioManager.getAudioScene((err, value) => { - if (err) { - console.error('Failed to obtain the audio scene mode.​ ${err.message}'); - return; - } - console.log('Audio scene mode ${value)'); - }) - ``` diff --git a/zh-cn/application-dev/media/Readme-CN.md b/zh-cn/application-dev/media/Readme-CN.md index 42191af14d1636ed622abd4a5271a8d74a315007..f069d43ad040419bc6efdbda2b6051b6e3d055cc 100755 --- a/zh-cn/application-dev/media/Readme-CN.md +++ b/zh-cn/application-dev/media/Readme-CN.md @@ -6,7 +6,6 @@ - [音频录制开发指导](audio-recorder.md) - [音频渲染开发指导](audio-renderer.md) - [音频采集开发指导](audio-capturer.md) - - [音频管理开发指导](audio-management.md) - 视频 - [视频播放开发指导](video-playback.md) diff --git a/zh-cn/application-dev/media/audio-management.md b/zh-cn/application-dev/media/audio-management.md deleted file mode 100644 index 380e6639d9226693a8c2816ce05ebd88f86c619d..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-management.md +++ /dev/null @@ -1,138 +0,0 @@ -# 音频管理开发指导 - -## 场景介绍 - -音频管理的主要工作是音量调节与音量查询,以及输入/输出设备查询。 - - -## 接口说明 - -**表1** audio的相关接口 - -| 接口名 | 描述 | -| -------- | -------- | -| getAudioManager(): AudioManager | 获得音频管理器。 | -| AudioManager | 音频管理器。具体参考表 音频管理相关的interface AudioManager。 | -| AudioDeviceDescriptor | 描述音频设备。 | -| AudioVolumeType | 表示音频流类型的枚举。 | -| DeviceFlag | 表示可获取的设备种类的枚举。 | -| DeviceRole | 表示设备角色的枚举。 | -| DeviceType | 表示设备类型的枚举。 | -| AudioScene | 表示音频场景的枚举。 | - -**表2** 音频管理相关的interface **AudioManager** - -| 接口名 | 描述 | -| -------- | -------- | -| setVolume(audioType: AudioVolumeType,volume: number,callback: AsyncCallback<void>): void | 改变某个流的音量。 | -| setVolume(audioType: AudioVolumeType,volume: number): Promise<void> | 改变某个流的音量。 | -| getVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void | 获得某个流的音量。 | -| getVolume(audioType: AudioVolumeType): Promise<number> | 获得某个流的音量。 | -| getMinVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void | 获得某个流的最小音量。 | -| getMinVolume(audioType: AudioVolumeType): Promise<number> | 获得某个流的最小音量。 | -| getMaxVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void | 获得某个流的最大音量。 | -| getMaxVolume(audioType: AudioVolumeType): Promise<number> | 获得某个流的最大音量。 | -| getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void | 获得设备列表。 | -| getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors> | 获得设备列表。 | -| setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback): void | 激活设备,使用callback返回异步结果 | -| setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise | 激活设备,使用Promise返回异步结果。 | -| isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback): void | 检查设备是否激活,使用callback返回异步结果。 | -| isDeviceActive(deviceType: ActiveDeviceType): Promise | 检查设备是否激活,使用Promise返回异步结果。 | -| on(type: 'deviceChange', callback: AsyncCallback): void | 订阅设备更改事件。 当设备连接或断开时,注册的客户端将收到回调。 | -| setAudioScene(scene: AudioScene, callback: AsyncCallback): void | 设置音频场景模式,使用callback返回异步结果。 | -| setAudioScene(scene: AudioScene): Promise | 设置音频场景模式,使用Promise返回异步结果。 | -| getAudioScene(callback: AsyncCallback): void | 获取音频场景模式,使用callback返回异步结果。 | -| getAudioScene(): Promise | 获取音频场景模式,使用Promise返回异步结果。 | - -**表3** 表示音频设备的interface **AudioDeviceDescriptor** - -| 属性 | 描述 | -| -------- | -------- | -| deviceRole: DeviceRole | 设备角色。 | -| deviceType: DeviceType | 设备类型。 | - -**表4** 表示音频流类型的枚举**AudioVolumeType** - -| 枚举值 | 描述 | -| -------- | -------- | -| VOICE_CALL = 0 | 语音通话。 | -| MEDIA = 1 | 媒体声音。 | -| RINGTONE = 2 | 铃声。 | -| VOICE_ASSISTANT = 9 | 语音助手。 | - -**表5** 表示可获取的设备种类的枚举**DeviceFlag** - -| 枚举值 | 描述 | -| -------- | -------- | -| OUTPUT_DEVICES_FLAG = 1 | 输出设备。 | -| INPUT_DEVICES_FLAG = 2 | 输入设备。 | -| ALL_DEVICES_FLAG = 3 | 所有设备。 | - -**表6** 表示设备角色的枚举**DeviceRole** - -| 枚举值 | 描述 | -| -------- | -------- | -| INPUT_DEVICE = 1 | 输入设备。 | -| OUTPUT_DEVICE = 2 | 输出设备。 | - -**表7** 表示设备类型的枚举**DeviceType** - -| 枚举值 | 描述 | -| -------- | -------- | -| INVALID = 0 | 无效。 | -| SPEAKER = 2 | 扬声器。 | -| WIRED_HEADSET = 3 | 有线耳机。 | -| BLUETOOTH_SCO = 7 | 蓝牙设备。 | -| BLUETOOTH_A2DP = 8 | 支持A2DP的蓝牙设备。 | -| MIC = 15 | 麦克风。 | - -**表8** 表示音频模式的枚举** **AudioScene ** - -| Name | Description | -| :------------------------- | :----------------------- | -| AUDIO_SCENE_DEFAULT = 0 | 默认的音频。
| -| AUDIO_SCENE_RINGING = 1 | 响铃音频场景。
| -| AUDIO_SCENE_PHONE_CALL = 2 | 电话音频场景。
| -| AUDIO_SCENE_VOICE_CHAT = 3 | 语音聊天音频场景。
| - -## 开发步骤 - -1. 获取音频控制器。 - ``` - const audioManager = audio.getAudioManager(); - ``` - -2. 改变媒体流的声音。 - ``` - audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { - if (err) { - console.error(`failed to get volume ${err.message}`); - return; - } - console.log(`Media getVolume ${value}`); - }); - ``` - -## 使用方法 - -**setAudioScene** - -**示例** - -1. 获取音频管理器。 - - ``` - const audioManager = audio.getAudioManager(); - ``` - -2. 获取当前的音频场景。 - - ``` - audioManager.getAudioScene((err, value) => { - if (err) { - console.error('Failed to obtain the audio scene mode.​ ${err.message}'); - return; - } - console.log('Audio scene mode ${value)'); - }) - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-camera.md b/zh-cn/application-dev/reference/apis/js-apis-camera.md index ab8cf746f11690dfc0982bf8905c9ee12e2e38d5..9df4fb1133a6cb211b2450e30a1494984e5e5bed 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -1,7 +1,7 @@ # 相机管理 > **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块