“摄像头和麦克风被阻止"的事件侦听器被允许 [英] Event listener that "camera and microphone blocked" is allowed

查看:39
本文介绍了“摄像头和麦克风被阻止"的事件侦听器被允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过getUserMedia,可能是UserMedia被用户屏蔽了.

By getUserMedia, it is possible that UserMedia is blocked by user.

 navigator.mediaDevices.getUserMedia({ audio: true })
      .then((stream) => {
        ...
      })
      .catch(() => {
        this.usermedia_blocked = true;
      });

当设置更改为始终允许"时,我想继续后续任务.但是我怎么能检测到总是允许和完成"被点击?

When the setting is changed to "always allow", I want to continue the subsequent task. But how can I detect that "always allow & done" is clicked?

点击始终允许并完成"后出现在开始视频通话中.我想做同样的事情.

Appear.in start video call after "always allow & done " is clicked. I want to do the same thing.

推荐答案

appear.in developer here.要做的是轮询 navigator.mediaDevices.enumerateDevices(),检查我们的摄像头和麦克风上是否有设备标签(这意味着权限已重新授予),然后再次调用 getUserMedia.

appear.in developer here. What do is to poll navigator.mediaDevices.enumerateDevices(), check if we have device labels on the camera and microphone (which implies permission has been re-granted) and then call getUserMedia again.

这篇关于“摄像头和麦克风被阻止"的事件侦听器被允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆