The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission,在当前上下文中,用户代理或平台不允许该请求,可能是因为用户拒绝了权限。具体原因是iphone手机不允许直接video标签自动播放autoplay。
具体解决方案:

// H5调用电脑摄像头API,成功则返回视频流
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.mediaDevices.getUserMedia
if (!navigator.getUserMedia) {
console.error('浏览器不支持摄像头!!!!!')
return
}
navigator.mediaDevices
.getUserMedia({
video: {
facingMode: { exact: 'environment' },
width: 1920,
height: 1080,
},
})
.then((success) => {
this.isCamera = false
// 摄像头开启成功
this.$refs.video.srcObject = success
// 播放摄像头画面
const p = this.$refs.video.play()
if (p !== undefined) {
p.then(() => {
this.$refs.video.pause()
setTimeout(() => {
this.$refs.video.play()
}, 0)
}).catch((e) => {
console.log(e, 'undefinedPlay报错')
})
}
})
.catch((error) => {
console.error('摄像头开启失败,请检查摄像头是否可用!', error)
})
 
 

The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission,iphone手机video标签报错的更多相关文章

  1. 提交表单存在html标签报错-检测到有潜在危险的 Request.Form 值

    1..aspx页面 在.aspx文件头中加入这句<%@ Page validateRequest="false" %> 2.通用方法 修改web.config文件, & ...

  2. axios跨域请求报错:Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

    在做项目时,用到axios,数据用post提交时,老是报错,错误提示为: Access to XMLHttpRequest at 'http://127.0.0.1:3000/api/add' fro ...

  3. The request was rejected because the URL contained a potentially malicious String ";"报错解决

    报错信息 浏览器中看到的报错 错误摘要: The request was rejected because the URL contained a potentially malicious Stri ...

  4. DOM解析XML报错:Content is not allowed in prolog

    报错内容为: Content is not allowed in prolog. Nested exception: Content is not allowed in prolog. 网上所述总结来 ...

  5. 报错:1130-host ... is not allowed to connect to this MySql server

    报错:1130-host ... is not allowed to connect to this MySql server   解决方法: 1. 改表法. 可能是你的帐号不允许从远程登陆,只能在l ...

  6. 报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用localhost

    执行如下命令报错 mysql -uroot -h${hostIp} -p Enter password:********* ERROR (HY000): Host '$hostIp' is not a ...

  7. 使用百度编辑器时,报错:从客户端("...)中检测到有潜在危险的 Request.Form 值

    ajax请求失败,提交不上去 起初没找到报错的这句话,可能由于我用了其他第三方插件的原因,后来改动了一下,出现了这个错误 然后百度得到答案:http://www.cnblogs.com/tearer/ ...

  8. 相对路径获取项目文件 及报错 No mapping found for HTTP request with URI XXX in DispatcherServlet with name ‘springmvc’解决方法

    首先一点,WebRoot目录下的文件是都可以通过浏览器输入路径,直接读取到的 例如这样: 而WebRoot下面WEB-INF是无法浏览器输入路径直接读取的. 因为是受保护的. 如果jsp读取一个图片的 ...

  9. web.xml文件报错:The processing instruction target matching "[xX][mM][lL]" is not allowed.

    昨晚把我的项目上传到了gitlab,然后今天在公司从gitlab下载下来, 发现web.xml报错.

  10. django程序报错CSRF verification failed. Request aborted.

    django程序的html页面中form的method='post'的时候报错 Forbidden (403) CSRF verification failed. Request aborted.He ...

随机推荐

  1. Blazor前后端框架Known-V1.2.12

    V1.2.12 Known是基于C#和Blazor开发的前后端分离快速开发框架,开箱即用,跨平台,一处代码,多处运行. Gitee: https://gitee.com/known/Known Git ...

  2. 《流畅的python》— 列表推导与生成器表达式

    列表推导是构建列表(list)的快捷方式,而生成器表达式则可以用来创建其他任何类型的序列.如果你的代码里并不经常使用它们,那么很可能你错过了许多写出可读性更好且更高效的代码的机会. 很多Python ...

  3. Pytest 框架执行用例流程浅谈

    背景: 根据以下简单的代码示例,我们将从源码的角度分析其中的关键加载执行步骤,对pytest整体流程架构有个初步学习. 代码示例: import pytest def test_add(): asse ...

  4. QA|selenium在send_keys时报错dict object has no attribute ''|UI自动化测试

    Q:selenium在send_keys时报错dict object has no attribute 'send_keys',如下图 增加了print(type(e1))发现确实是字典类型,怪了,按 ...

  5. JS深入学习笔记 - 第一章.构造函数原型与原型链

    1.构造函数和原型 1.1 概述 在典型的 OOP语言中(如Java),都存在类的概念,类就是对象的模板,对象就是类的实例,但在ES6之前,JS并没有引入类的概念. 在ES6之前,对象不是基于类创建的 ...

  6. 给网站添加xml地图索引写法和应用

    使用php给网站添加xml地图索引写法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...

  7. 记一次 .NET某账本软件 非托管泄露分析

    一:背景 1. 讲故事 中秋国庆长假结束,哈哈,在老家拍了很多的短视频,有兴趣的可以上B站观看:https://space.bilibili.com/409524162 ,今天继续给大家分享各种奇奇怪 ...

  8. ios ipa apple company 开发者账号申请分享攻略

    ios公司开发者账号申请分享攻略 好不容易终于申请下来了ios 公司开发者账号,真是一路艰辛和漫长啊,特别是对于远在大洋彼岸的大中华国家.以下我就分享一下这一路下来的经验,希望对于那些新手同仁们有所帮 ...

  9. Vocabulary

    词汇(Vocabulary) blackmail ( n.) :the obtaining of money or advancement by threatening to make known u ...

  10. C转C++ 个人总结

    # C转C++ 个人总结 1.使用C++的好处 2.using namespace std 3.cin和cout #include<iostream> //必备的头文件 using nam ...