liuxl126
liuxl126
  • 发布:2021-09-24 14:16
  • 更新:2021-09-24 17:25
  • 阅读:522

【报Bug】live-pusher在ios中无法触发statechange,netstatus,error,安卓是正常的

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows7旗舰版

HBuilderX类型: 正式

HBuilderX版本号: 3.2.3

手机系统: iOS

手机系统版本号: iOS 13.4

手机厂商: 苹果

手机机型: IPhoneX

页面类型: nvue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<live-pusher device-position="back" id='livePusher' ref="livePusher" class="livePusher" url="" mode="SD" muted="true" enable-camera="true" auto-focus="true"

beauty="1" whiteness="2"
aspect="1:1"
local-mirror=""
@statechange="statechange"
@netstatus="netstatus"
@error="error"

</live-pusher>
onReady() {
this.context = uni.createLivePusherContext("livePusher", this)
},
onShow() {
this.$nextTick(() => {
setTimeout(() => {
this.startPreview()
}, 10)
})
},
this.context.startPreview({
success: (a) => {
// 用户拒绝和允许都会走success,打印结果为{"errMsg":"startPreview:ok"}
console.log("livePusher.switchCamera:" + JSON.stringify(a));
this.checkOpenPermission()

},
fail: (e) => {
console.log(e)
}
});

操作步骤:

一进入页面开始开启摄像头,手机会自动提示用户允许活拒绝,用户拒绝后,不触发statechange,error事件,并且正常走success里面。

预期结果:

期望可以判断用户是否允许开启了摄像头,如未开启,弹框提示用户去开启

实际结果:

现在没有方式去判断,permission.js不知道放在什么时候去判断,放在startPreview用户还未点击拒绝,permission判断就走完了。
其他人也提过类似的问题,如下图

bug描述:

使用live-pusher自定义摄像头拍照,已经在manifest.json里勾选了直播流。现在的情况是进入当前页面需要开启直播流,手机会提示用户拒绝或允许开启权限,用户拒绝开启摄像头后,ios不会触发statechange和error事件,安卓是正常的。并且this.context.startPreview开启摄像头的时候,用户没有开启权限,也会走success里面。怎么样才能判断用户是否开启了权限呢?使用permission.js判断放在什么时候判断合适呢?

2021-09-24 14:16 负责人:天生DR 分享
已邀请:
天生DR

天生DR - 天生我材必有用

相机权限的话 可以通过 Native.js 去判断
你看下这篇文章是不是你想要的 https://ask.dcloud.net.cn/article/35915

该问题目前已经被锁定, 无法添加新回复