[英]OT.Publisher Access Denied: End-user denied permission to hardware devices getUserMedia
I am trying to create a Live Streaming with Open Tok JS SDK with Capacitor + Ionic + Vue.js but It seems that the code is not supported by iOS.我正在尝试使用带有电容器 + 离子 + Vue.js 的 Open Tok JS SDK 创建实时流,但 iOS 似乎不支持该代码。
[log] - {"code":1500,"message":"OT.Publisher Access Denied: Permission Denied: End-user denied permission to hardware devices (getUserMedia error: NotAllowedError)","name":"OT_USER_MEDIA_ACCESS_DENIED","stack":"C@capacitor://localhost/js/chunk-90ec66da.9f0ce302.js:37:52873\nx@capacitor://localhost/js/chunk-90ec66da.9f0ce302.js:37:53369\ncapacitor://localhost/js/chunk-90ec66da.9f0ce302.js:37:54452\npromiseReactionJob@[native code]","originalMessage":"The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.","originalName":"NotAllowedError"}
Debug error Screenshot from XCode来自 XCode 的调试错误截图
Anyone have resolved the bug?有人解决了这个错误吗? How can I resolve it?
我该如何解决?
Encryption based security The getUserMedia() method is only available in secure contexts.基于加密的安全性getUserMedia() 方法仅在安全上下文中可用。 A secure context is one the browser is reasonably confident contains a document which was loaded securely, using HTTPS/TLS, and has limited exposure to insecure contexts.
安全上下文是浏览器有理由确信包含使用 HTTPS/TLS 安全加载的文档,并且对不安全上下文的暴露有限。 If a document isn't loaded in a secure context, the navigator.mediaDevices property is undefined, making access to getUserMedia() impossible.
如果文档未在安全上下文中加载,则 navigator.mediaDevices 属性未定义,从而无法访问 getUserMedia()。
Attempting to access getUserMedia() in this situation will result in a TypeError.在这种情况下尝试访问 getUserMedia() 将导致 TypeError。
Document source security Because of the obvious security concern associated with getUserMedia() if used unexpectedly or without security being carefully managed, it can only be used in secure contexts.文档源安全由于与 getUserMedia() 相关的明显安全问题,如果意外使用或没有仔细管理安全性,它只能在安全上下文中使用。 There are a number of insecure ways to load a document that might, in turn, attempt to call getUserMedia().
有许多不安全的方式来加载文档,这些方式可能反过来尝试调用 getUserMedia()。 The following are examples of situations in which getUserMedia() is not permitted to be called:
以下是不允许调用 getUserMedia() 的情况示例:
A document loaded into a sandboxed element cannot call getUserMedia() unless the has its sandbox attribute set to allow-same-origin.加载到沙盒元素中的文档不能调用 getUserMedia(),除非它的沙盒属性设置为允许同源。 A document loaded using a data:// or blob:// URL which has no origin (such as when one of these URLs is typed by the user into the address bar) cannot call getUserMedia().
使用 data:// 或 blob:// URL 加载的文档没有来源(例如当用户在地址栏中键入这些 URL 之一时)不能调用 getUserMedia()。 These kinds of URLs loaded from JavaScript code inherit the script's permissions.
从 JavaScript 代码加载的这些类型的 URL 继承了脚本的权限。 Any other situation in which there is no origin, such as when the srcdoc attribute is used to specify the contents of a frame.
没有来源的任何其他情况,例如当 srcdoc 属性用于指定框架的内容时。
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#security https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#security
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.