Skip to main content

OH_AudioSessionManager_SetDefaultOutputDevice

Function OH_AudioSessionManager_SetDefaultOutputDevice 

Source
pub unsafe extern "C" fn OH_AudioSessionManager_SetDefaultOutputDevice(
    audioSessionManager: *mut OH_AudioSessionManager,
    deviceType: OH_AudioDevice_Type,
) -> OH_AudioCommon_Result
Available on crate features api-12 and api-20 only.
Expand description

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

§Arguments

  • audioSessionManager - the [#OH_AudioSessionManager] returned by the [#OH_AudioManager_GetAudioSessionManager]

  • deviceType - The target device. The available deviceTypes are: EARPIECE: Built-in earpiece SPEAKER: Built-in speaker DEFAULT: System default output device

§Returns

  • [#AUDIOCOMMON_RESULT_SUCCESS] if execution succeeds or [#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM] if parameter validation fails or [#AUDIOCOMMON_RESULT_ERROR_SYSTEM] if system state error

Available since API-level: 20