uniapp:钉钉小程序录音



其中需要注意几个重要地方

1、调用回调必须这样写不能这样 ((res) =>{});

_this.recorderManager.onerror = (err) => {
    console.log('onerror', err)
}

_this.recorderManager.onstop = (res) => {
    console.log('onstop', res)
}

2、播放录音时不能直接读取地址,需要downloadFile 才能读取

dd.downloadFile({
    url: _this.tempFilePath,
    success: ({
		filePath
	}) => {
		let audioManager = dd.getBackgroundAudioManager();
		audioManager.src = filePath;
        ......
	},
	fail: (res) => {
		dd.showToast({
			content: res.errorMessage || res.error,
			type: "fail",
			duration: 3000
		})
	}
})

你可能感兴趣的:(前端,uni-app,钉钉,小程序)