RecorderManager.onError(function listener)
简介
监听录音错误事件。
使用限制
基础库 4.0.0
或更高版本支持。
参数
function listener 错误事件的监听函数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errMsg | string | 错误信息 |
errMsg 说明
错误信息 | 说明 |
---|---|
Parameter error: A10001 | 参数错误 |
Invalid sampleRate "sampleRate", sampleRate should be one of ${availableSampleRate}: A10002 | sampleRate 不在可取值范围内 |
Invalid numberOfChannels ${numberOfChannels}, numberOfChannels should be one of ${availableChannels} : A10003 | numberOfChannels 不在可取值范围内 |
Invalid encodeBitRate "encodeBitRate", encodeBitRate should be greater than $min and less than $max : A10004 | encodeBitRate 不在可取值范围内 |
Invalid format "format", format should be one of ${availableRecordingFormat} : A10005 | format 不在可取值范围内 |
Invalid audioSource "audioSource", audioSource should be one of ${availableAudioSources} : A10006 | audioSource 不在可取值范围内 |
Invalid duration $duration, duration should be between 0 and $maxDuration : A10007 | duration 不在可取值范围内 |
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);
});
},
});