Available on crate feature
api-12 only.Structs§
- OH_
Audio Session Manager - Declare the audio session manager. The handle of audio session manager is used for audio session related functions.
- OH_
Audio Session_ Bluetooth AndNearlink Preferred Record Category api-21 - Enumerates the categories application prefer to use when recording with bluetooth and nearlink.
- OH_
Audio Session_ Concurrency Mode - Declare the audio concurrency modes.
- OH_
Audio Session_ Deactivated Event - declare the audio session deactivated event
- OH_
Audio Session_ Deactivated Reason - Declare the audio deactivated reasons.
- OH_
Audio Session_ Output Device Change Recommended Action api-20 - Declare the recommend action when device change.
- OH_
Audio Session_ Scene api-20 - Declare the audio session scene.
- OH_
Audio Session_ State Change Hint api-20 - Declare the audio session state change hints.
- OH_
Audio Session_ State Changed Event api-20 - declare the audio session state change event
- OH_
Audio Session_ Strategy - declare the audio session strategy
Functions§
- OH_
Audio ⚠Manager_ GetAudio Session Manager - Fetch the audio session manager handle. The audio session manager handle should be the first parameter in audio session related functions
- OH_
Audio ⚠Session Manager_ Activate Audio Session - Activate the audio session for the current pid application.
If [
#OH_AudioSessionManager_SetScene] is called, it will take focus when calling this method. - OH_
Audio ⚠Session Manager_ Deactivate Audio Session - Deactivate the audio session for the current pid application.
- OH_
Audio ⚠Session Manager_ Enable Mute Suggestion When MixWith Others api-23 - Enables mute suggestion callback function when using [
#CONCURRENCY_MIX_WITH_OTHERS] mode. Usually when using mix mode, application won’t receive state change event when there is another audio playing simultaneously. But in some scenarios, like game or radio, the application may intend to mute its audio to achieve better user experience. If enabled, the mute and unmute suggestion hint will be sent by [#OH_AudioSession_StateChangedCallback] registered by [#OH_AudioSessionManager_RegisterStateChangeCallback]. Mute suggestion means there is another application starting non-mixable audio. This function only supports audio session with [#OH_AudioSession_Scene] set and activated with [#CONCURRENCY_MIX_WITH_OTHERS] mode. And it takes effect only once during activation, so application need to enable it every time before activation. - OH_
Audio ⚠Session Manager_ GetAvailable Devices api-21 - Get available devices by device usage.
- OH_
Audio ⚠Session Manager_ GetBluetooth AndNearlink Preferred Record Category api-21 - Gets the prefered record category with bluetooth and nearlink device.
- OH_
Audio ⚠Session Manager_ GetDefault Output Device api-20 - Gets the default output device.
- OH_
Audio ⚠Session Manager_ GetSelected Media Input Device api-21 - Gets the selected media input device.
- OH_
Audio ⚠Session Manager_ IsAudio Session Activated - Querying whether the current pid application has an activated audio session.
- OH_
Audio ⚠Session Manager_ IsOther Media Playing api-23 - Returns if there is any other application playing audio in media usage, including media session activated.
- OH_
Audio ⚠Session Manager_ Register Available Devices Change Callback api-21 - Register available device change event callback.
- OH_
Audio ⚠Session Manager_ Register Current Input Device Change Callback api-21 - Register the audio session input device change event callback.
- OH_
Audio ⚠Session Manager_ Register Current Output Device Change Callback api-20 - Register the audio session device change event callback.
- OH_
Audio ⚠Session Manager_ Register Session Deactivated Callback - Register the audio session deactivated event callback.
- OH_
Audio ⚠Session Manager_ Register State Change Callback api-20 - Register the audio session state change event callback.
- OH_
Audio ⚠Session Manager_ Release Device api-21 - Release the audio device descriptor object.
- OH_
Audio ⚠Session Manager_ Release Devices api-20 - Release the audio device descriptor array object.
- OH_
Audio ⚠Session Manager_ Select Media Input Device api-21 - Sets the media input device.
This function is not valid for call recording, whose SourceType is
SOURCE_TYPE_VOICE_CALL or SOURCE_TYPE_VOICE_COMMUNICATION.
In scenarios where there are concurrent recording streams with higher priority,
the actual input device used by the application may differ from the selected one.
The application can use
OH_AudioSessionManager_RegisterCurrentInputDeviceChangeCallbackto register a callback to listen for the actual input device. - OH_
Audio ⚠Session Manager_ SetBluetooth AndNearlink Preferred Record Category api-21 - Sets the prefered record category with bluetooth and nearlink device.
The application can set this category before bluetooth and nearlink connected, and the system will
prefer to use bluetooth and nearlink to record when the device connected.
In scenarios where there are concurrent recording streams with higher priority,
the actual input device used by the application may differ from the prefered one.
The application can use
OH_AudioSessionManager_RegisterCurrentInputDeviceChangeCallbackto register a callback to listen for the actual input device. - OH_
Audio ⚠Session Manager_ SetDefault Output Device api-20 - Sets the default output device. This function applys on audiorenderers whose StreamUsage are STREAM_USAGE_VOICE_COMMUNICATION/STREAM_USAGE_VIDEO_COMMUNICATION/STREAM_USAGE_VOICE_MESSAGE. Setting the device will only takes effect if no other accessory such as headphones are in use
- OH_
Audio ⚠Session Manager_ SetScene api-20 - Set scene for audio session.
- OH_
Audio ⚠Session Manager_ Unregister Available Devices Change Callback api-21 - Unregister available device change event callback.
- OH_
Audio ⚠Session Manager_ Unregister Current Input Device Change Callback api-21 - Unregister the audio session input device change event callback.
- OH_
Audio ⚠Session Manager_ Unregister Current Output Device Change Callback api-20 - Unregister the audio session device change event callback.
- OH_
Audio ⚠Session Manager_ Unregister Session Deactivated Callback - Unregister the audio session deactivated event callback.
- OH_
Audio ⚠Session Manager_ Unregister State Change Callback api-20 - Unregister the audio session state change event callback.
Type Aliases§
- OH_
Audio Session_ Available Device Changed Callback api-21 - This function pointer will point to the callback function that is used to return the changing audio device descriptors. There may be more than one audio device descriptor returned.
- OH_
Audio Session_ Current Input Device Changed Callback api-21 - This function pointer will point to the callback function that is used to return the audio session input device change event.
- OH_
Audio Session_ Current Output Device Changed Callback api-20 - This function pointer will point to the callback function that is used to return the audio session device change event.
- OH_
Audio Session_ Deactivated Callback - This function pointer will point to the callback function that is used to return the audio session deactivated event.
- OH_
Audio Session_ State Changed Callback api-20 - This function pointer will point to the callback function that is used to return the audio session state change event.