configureAudioEnvironment
Configures and starts the audio environment used by STMediaRunner.
Declaration
public func configureAudioEnvironment(
mode: STAudioEnvironmentMode = .default,
options: STAudioEnvironmentOptions = []
) -> STResultOverview
Configures the audio session/environment for subsequent media operations. The mode defaults to .default and options defaults to an empty option set ([]), so no additional routing or mixing options are requested unless supplied. For an application that needs Bluetooth headset microphone input, consider .allowBluetoothHFP; for Bluetooth playback, consider .allowBluetoothA2DP; for speaker routing, consider .defaultToSpeaker. Use .mixWithOthers only when the application should coexist with other audio. Choose options according to your audio-routing requirements rather than enabling all options unconditionally.
Parameters
mode selects the audio-environment mode. Default: .default.
options supplies zero or more audio-environment options. Default: no additional options.
Options can be combined using Swift OptionSet syntax.
let result = STMediaRunner.shared.configureAudioEnvironment(
mode: .voiceChat,
options: [.allowBluetoothHFP, .defaultToSpeaker]
)
Return value
Returns the result of starting/configuring the audio environment. If the audio-environment manager is unavailable, the method returns .audioEnvironmentError.