CyunZing
CyunZing
  • 发布:2025-08-27 18:41
  • 更新:2025-08-27 18:45
  • 阅读:16

【报Bug】harmonyNext使用navigator.getUserMedia提示Permission denied(已经使用UTS方式申请摄像头麦克风权限)

分类:鸿蒙Next

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: Apple M3 15.3.1

HBuilderX类型: 正式

HBuilderX版本号: 4.76

手机系统: HarmonyOS NEXT

手机系统版本号: HarmonyOS 5.0.0

手机厂商: 模拟器

手机机型: 模拟器

页面类型: vue

vue版本: vue3

打包方式: 离线

项目创建方式: HBuilderX

操作步骤:

1、在app刚刚启动的时候就申请了麦克风和摄像头权限了
2、在vue模块里面使用renderJs调用下面代码时候提示错误,fail Permission denied ,这个在安卓平台上是正常的。

navigator.getUserMedia(  
    {  
        audio: {  
            echoCancellation: true,  
            noiseSuppression: true  
        },  
        video: false,  
    },  
    (stream) => {  
        console.log("okok")  
    },  
    (error) => {  
        console.log("fail", error.message)  
    }  
)

预期结果:
navigator.getUserMedia(  
    {  
        audio: {  
            echoCancellation: true,  
            noiseSuppression: true  
        },  
        video: false,  
    },  
    (stream) => {  
        console.log("okok")  
    },  
    (error) => {  
        console.log("fail", error.message)  
    }  
)

预期结果是打印“okok”

实际结果:
navigator.getUserMedia(  
    {  
        audio: {  
            echoCancellation: true,  
            noiseSuppression: true  
        },  
        video: false,  
    },  
    (stream) => {  
        console.log("okok")  
    },  
    (error) => {  
        console.log("fail", error.message)  
    }  
)

实际结果是打印“fail Permission denied”

bug描述:

1、在app刚刚启动的时候就申请了麦克风和摄像头权限了
2、在vue模块里面使用renderJs调用下面代码时候提示错误,fail Permission denied ,这个在安卓平台上是正常的。

navigator.getUserMedia(  
    {  
        audio: {  
            echoCancellation: true,  
            noiseSuppression: true  
        },  
        video: false,  
    },  
    (stream) => {  
        console.log("okok")  
    },  
    (error) => {  
        console.log("fail", error.message)  
    }  
)
2025-08-27 18:41 负责人:无 分享
已邀请:
CyunZing

CyunZing (作者)

CyunZing

CyunZing (作者)

分别是用过下面集中方式都不行

  • navigator.mediaDevices.getUserMedia
  • navigator.getUserMedia
  • navigator.webkitGetUserMedia

要回复问题请先登录注册