Skip to main content

Module audio_session_manager

Module audio_session_manager 

Source
Available on crate feature api-12 only.

Structs§

OH_AudioSessionManager
Declare the audio session manager. The handle of audio session manager is used for audio session related functions.
OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategoryapi-21
Enumerates the categories application prefer to use when recording with bluetooth and nearlink.
OH_AudioSession_ConcurrencyMode
Declare the audio concurrency modes.
OH_AudioSession_DeactivatedEvent
declare the audio session deactivated event
OH_AudioSession_DeactivatedReason
Declare the audio deactivated reasons.
OH_AudioSession_OutputDeviceChangeRecommendedActionapi-20
Declare the recommend action when device change.
OH_AudioSession_Sceneapi-20
Declare the audio session scene.
OH_AudioSession_StateChangeHintapi-20
Declare the audio session state change hints.
OH_AudioSession_StateChangedEventapi-20
declare the audio session state change event
OH_AudioSession_Strategy
declare the audio session strategy

Functions§

OH_AudioManager_GetAudioSessionManager
Fetch the audio session manager handle. The audio session manager handle should be the first parameter in audio session related functions
OH_AudioSessionManager_ActivateAudioSession
Activate the audio session for the current pid application. If [#OH_AudioSessionManager_SetScene] is called, it will take focus when calling this method.
OH_AudioSessionManager_DeactivateAudioSession
Deactivate the audio session for the current pid application.
OH_AudioSessionManager_EnableMuteSuggestionWhenMixWithOthersapi-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_AudioSessionManager_GetAvailableDevicesapi-21
Get available devices by device usage.
OH_AudioSessionManager_GetBluetoothAndNearlinkPreferredRecordCategoryapi-21
Gets the prefered record category with bluetooth and nearlink device.
OH_AudioSessionManager_GetDefaultOutputDeviceapi-20
Gets the default output device.
OH_AudioSessionManager_GetSelectedMediaInputDeviceapi-21
Gets the selected media input device.
OH_AudioSessionManager_IsAudioSessionActivated
Querying whether the current pid application has an activated audio session.
OH_AudioSessionManager_IsOtherMediaPlayingapi-23
Returns if there is any other application playing audio in media usage, including media session activated.
OH_AudioSessionManager_RegisterAvailableDevicesChangeCallbackapi-21
Register available device change event callback.
OH_AudioSessionManager_RegisterCurrentInputDeviceChangeCallbackapi-21
Register the audio session input device change event callback.
OH_AudioSessionManager_RegisterCurrentOutputDeviceChangeCallbackapi-20
Register the audio session device change event callback.
OH_AudioSessionManager_RegisterSessionDeactivatedCallback
Register the audio session deactivated event callback.
OH_AudioSessionManager_RegisterStateChangeCallbackapi-20
Register the audio session state change event callback.
OH_AudioSessionManager_ReleaseDeviceapi-21
Release the audio device descriptor object.
OH_AudioSessionManager_ReleaseDevicesapi-20
Release the audio device descriptor array object.
OH_AudioSessionManager_SelectMediaInputDeviceapi-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_RegisterCurrentInputDeviceChangeCallback to register a callback to listen for the actual input device.
OH_AudioSessionManager_SetBluetoothAndNearlinkPreferredRecordCategoryapi-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_RegisterCurrentInputDeviceChangeCallback to register a callback to listen for the actual input device.
OH_AudioSessionManager_SetDefaultOutputDeviceapi-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_AudioSessionManager_SetSceneapi-20
Set scene for audio session.
OH_AudioSessionManager_UnregisterAvailableDevicesChangeCallbackapi-21
Unregister available device change event callback.
OH_AudioSessionManager_UnregisterCurrentInputDeviceChangeCallbackapi-21
Unregister the audio session input device change event callback.
OH_AudioSessionManager_UnregisterCurrentOutputDeviceChangeCallbackapi-20
Unregister the audio session device change event callback.
OH_AudioSessionManager_UnregisterSessionDeactivatedCallback
Unregister the audio session deactivated event callback.
OH_AudioSessionManager_UnregisterStateChangeCallbackapi-20
Unregister the audio session state change event callback.

Type Aliases§

OH_AudioSession_AvailableDeviceChangedCallbackapi-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_AudioSession_CurrentInputDeviceChangedCallbackapi-21
This function pointer will point to the callback function that is used to return the audio session input device change event.
OH_AudioSession_CurrentOutputDeviceChangedCallbackapi-20
This function pointer will point to the callback function that is used to return the audio session device change event.
OH_AudioSession_DeactivatedCallback
This function pointer will point to the callback function that is used to return the audio session deactivated event.
OH_AudioSession_StateChangedCallbackapi-20
This function pointer will point to the callback function that is used to return the audio session state change event.