HomeDocs
Skip to main content

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

AttributeTypeDefaultRequiredDescription
successfunctionNoCallback function for a successful API call
failfunctionNoCallback function for a failed API call
completefunctionNoCallback function for an API call ending (called on success or failure)

object.success Callback Function

Parameters

Object res

AttributeTypeDescription
successstringtrue-success
audioSourcesstring[]The list of supported audio input sources, which can be used in RecorderManager.start() interface. Return value definition reference

Valid values for audioSource

AttributeDescriptionSupported Platform
autoAutomatically 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
micMicrophone (when no earphone is plugged in, it is the mobile phone microphone, and when earphone is plugged in, it is the earphone microphone).Android
camcorderThe microphone of the camera.Android

object.fail Callback Function

Parameters

Object res

AttributeTypeDescription
successstringfalse-failures

Sample Code

// pages/index/index.js
Page({
getAvailableAudioSources() {
dlt.getAvailableAudioSources({
success: (res) => {
console.log("success", res.audioSources);
},
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.