switchUserAudio

Switches the user's audio input to the specified device.

Workflow:

  1. Permission Check: Verifies if audio permissions are granted

  2. Media Constraints Setup: Configures constraints for the desired device

  3. Stream Retrieval and Switch: Creates a new audio stream with the specified device

  4. Error Handling and Fallback: Reverts to the previous device if the switch fails

Parameters

options

Options containing parameters and audio preference

Example:

val parameters = object : SwitchUserAudioParameters {
override val userDefaultAudioInputDevice = "defaultDeviceID"
override val prevAudioInputDevice = "oldDeviceID"
override val hasAudioPermission = true
// ... other properties
}

switchUserAudio(
SwitchUserAudioOptions(
parameters = parameters,
audioPreference = "newDeviceID"
)
)

Note:

This is a simplified implementation. Full implementation requires platform-specific media device access and stream management.