HomeDocs
跳到主要内容

RecorderManager.onError(function listener)

简介

监听录音错误事件。

使用限制

基础库 4.0.0 或更高版本支持。

参数

function listener 错误事件的监听函数

参数

Object res

属性类型说明
errMsgstring错误信息

errMsg 说明

错误信息说明
Parameter error: A10001参数错误
Invalid sampleRate "sampleRate", sampleRate should be one of ${availableSampleRate}: A10002sampleRate 不在可取值范围内
Invalid numberOfChannels ${numberOfChannels}, numberOfChannels should be one of ${availableChannels} : A10003numberOfChannels 不在可取值范围内
Invalid encodeBitRate "encodeBitRate", encodeBitRate should be greater than $min and less than $max : A10004encodeBitRate 不在可取值范围内
Invalid format "format", format should be one of ${availableRecordingFormat} : A10005format 不在可取值范围内
Invalid audioSource "audioSource", audioSource should be one of ${availableAudioSources} : A10006audioSource 不在可取值范围内
Invalid duration $duration, duration should be between 0 and $maxDuration : A10007duration 不在可取值范围内
Audio is recording, don't start record again : A10008已经开始录音,请勿重复开始
Audio is paused, pause record fail : A10009录音已暂停,请勿重复暂停
create record file is fail : A10010创建录音文件失败
Audio failed with permission denied : A10011没有录音权限
Audio is stop, don't stop record again : A10012录音已停止,请勿重复停止

示例代码

// pages/index/index.js

Page({
onError() {
const recorderManager = dlt.getRecorderManager();

recorderManager.onError((res) => {
console.log("error", res);
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.