title: Taro.getAvailableAudioSources(option)
sidebar_label: getAvailableAudioSources
Gets supported audio input sources.
Reference
Type
(option?: Option) => Promise<SuccessCallbackResult>
Parameters
Option
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
SuccessCallbackResult
audioSources
Valid values of res.audioSources
Property |
Description |
auto |
Automatic setup. The mobile microphone is used by default. The headset microphone is automatically adopted when the headset is plugged in. This setup applies to all platforms. |
buildInMic |
Mobile microphone for iOS only |
headsetMic |
Headset microphone for iOS only |
mic |
Microphone (if the headset is not plugged in, the mobile microphone is used; otherwise, the headset microphone is used) for Android only |
camcorder |
Same as mic. Suitable for audio and video recording. For Android only. |
voice_communication |
Same as mic. Suitable for real-time communication. For Android only. |
voice_recognition |
Same as mic. Suitable for speech recognition. For Android only. |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
Taro.getAvailableAudioSources |
✔️ |
|
|