微信小程序录音权限设置

微信小程序录音权限设置
在这里插入图片描述

methods: {
			recordShow(e) {
				var that = this;
				uni.getSetting({
					success(res) {
						// console.log(res.authSetting['scope.record']);
						//判断是否第一次获取录音功能
						if (!res.authSetting['scope.record']) {
							//调用后会立刻弹窗询问用户是否同意授权录音给小程序
							uni.authorize({
								scope: 'scope.record',
								success() {
									// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
									uni.startRecord()
								}
							})
							//判断录音是否是开启状态false没开启就跳转到开启页面
							if (res.authSetting['scope.record'] == false) {
								uni.openSetting({
									success(res) {
										console.log(res.authSetting)
									}
								});
							}
						} else if (res.authSetting['scope.record'] == true) {
							that.show = true;
							console.log(e.currentTarget.dataset.id);
							that.current = e.currentTarget.dataset.id;
						}
					}
				})
			},
		}

原文链接:https://blog.csdn.net/qq_39765048/article/details/120570666

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值