Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Small Program API Audio - Get the current input source


May 18, 2021 WeChat Mini Program Development Document


Table of contents


wx.getAvailableAudioSources(Object object)

Base library 2.1.0 starts to support, and low versions need to be compatible.

Get the currently supported audio input source

Parameters

Object object

Property Type The default Required Description
success function Whether The interface calls a successful callback function
fail function Whether The interface calls the failed callback function
complete function Whether Callback function at end of interface call (call succeeds, fails are executed)

object.success callback function

Parameters
Object res
Property Type Description
audioSources Array.<string> A list of supported audio input sources that can be used in the RecorderManager.start() interface. The return value defines the https://developer.android.com/reference/kotlin/android/media/MediaRecorder.AudioSource

The legal value of res.audioSources

Value Description The lowest version
auto Automatic settings, the default use of mobile phone microphone, plug in the headset and automatically switch the use of headphone microphone, all platforms apply
buildInMic Mobile microphone, iOS only
headsetMic Headset microphone, iOS only
Mic Microphones (phone microphones when you don't have a headset, headphone microphones when you plug in your headset), Android only
camcorder Same mic for recording audio and video content, Android only
voice_communication With mic, for real-time communication, Android only
voice_recognition Same mic, for speech recognition, Android only