dlt.getAvailableAudioSources
Introduction
Get the available audio input sources.
Usage Restrictions
Supported from 4.0.0
or higher version of the basic library.
Parameters
Object object
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
success | function | No | Callback function for a successful API call | |
fail | function | No | Callback function for a failed API call | |
complete | function | No | Callback function for an API call ending (called on success or failure) |
object.success Callback Function
Parameters
Object res
Attribute | Type | Description |
---|---|---|
success | string | true-success |
audioSources | string[] | The list of supported audio input sources, which can be used in RecorderManager.start() interface. Return value definition reference |
Valid values for audioSource
Attribute | Description | Supported Platform |
---|---|---|
auto | Automatically set, the mobile phone microphone is used by default, and after earphones are plugged in, the microphone of the earphones is switched automatically. | iOS/Android/devtools |
mic | Microphone (when no earphone is plugged in, it is the mobile phone microphone, and when earphone is plugged in, it is the earphone microphone). | Android |
camcorder | The microphone of the camera. | Android |
object.fail Callback Function
Parameters
Object res
Attribute | Type | Description |
---|---|---|
success | string | false-failures |
Sample Code
// pages/index/index.js
Page({
getAvailableAudioSources() {
dlt.getAvailableAudioSources({
success: (res) => {
console.log("success", res.audioSources);
},
});
},
});