play() failed because the user didn‘t interact with the document first
使用js调用音频文件报错,错误信息如下:
play() failed because the user didn’t interact with the document first
该报错是浏览器对于自动播放限制抛出的:play方法调用失败,因为用户没有先操作文档【用户没有先去跟网页做交互再执行音频播放】
解决方式:
构建 DOM 元素时先设置 muted="muted" 属性,调用 play 后再修改静音属性试下是否可以正常
play() failed because the user didn‘t interact with the document first的更多相关文章
- 音频播放时出现 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
<audio id="play" controls="controls" loop="loop"> <source src ...
- Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.
最近在开发一个网站时,有个需要是 如果有新预警信息要在网页中播放提示音.页面打开会请求是否有新信息,有则播放提示音.在Chrome的最新浏览器中,播放会报错,控制台显示Uncaught (in pro ...
- 需求:在浏览器加载完毕后,自动播放视频:出现play() failed because the user didn't interact with the document first.错误
解决方法:给video标签加入<video muted></video> 静音即可. Chrome 66为了避免标签产生随机噪音. 参考链接:https://juejin.im ...
- ERROR [localhost-startStop-1] - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/ap
ERROR [localhost-startStop-1] - Context initialization failed org.springframework.beans.factory.Bean ...
- JS自动播放音频 无效chrome设置 (Uncaught (in promise) DOMException: play() failed because the user didn't interact)
Chrome的autoplay政策在2018年4月做了更改.新的行为:浏览器为了提高用户体验,减少数据消耗,现在都在遵循autoplay政策,Chrome的autoplay 政策非常简单 muted ...
- Chrome 声音自动播放抱错问题【play() failed】
Chrome下调用play后抱错:DOMException: play() failed because the user didn't interact with the document firs ...
- [JavaScript] audio在浏览器中自动播放
audio 在浏览器中自动播放 autoplay 属性 autoplay 属性规定一旦音频就绪马上开始播放. 如果设置了该属性,音频将自动播放. 使用 autoplay 属性进行播放 //使用auto ...
- [JavaScript] html5 video标签注意事项
Chrome 66 禁止声音自动播放 声音无法自动播放这个在IOS/Android上面一直是个惯例,桌面版的Safari在2017年的11版本也宣布禁掉带有声音的多媒体自动播放功能,紧接着在2018年 ...
- selenium如何处理H5视频
selenium处理H5视频主要使用的是javascript,javascript函数有内置的对象叫arguments,arguments包含了调用的参数组,[0]代表取第一个值. currentSr ...
- 网页视频不能自动播放?HTML5 video报错Uncaught (in promise) DOMException解决方法
话说发哥四年前写了一个网页,如上图效果,实际网址http://pano.z01.com ,话说做好时是正常的,突然某一天,客户说你这个网站动画不见了,这是什么原因? 结果检查脚本一切正常. 其实也不是 ...
随机推荐
- 在windows上搭建spark遇到的问题
报错如下: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: --------- ...
- Kotlin属性委托
业务定义 对于属性,我们可以读取(get)和赋值(set),在Java中会定义get和set方法来操作属性,Kotlin的属性建议直接操作,一些业务的要求会对属性有额外的功能需求,在Java中会在ge ...
- hbase修改表TTL
创建表时可以指定TTL create 'test_lwt',{NAME=>'d',TTL=>3600} 设置test_lwt表数据TTL为3600秒 修改已存在的表TTL disable ...
- mysql修改密码报错:Your password does not satisfy the current policy requirements
这是 mysql 初始化时,使用临时密码,修改自定义密码时,由于自定义密码比较简单,就出现了不符合密码策略的问题. 密码策略问题异常信息: ERROR 1819 (HY000): Your passw ...
- Android studio java文件显示j爆红
今天在android studio打开一个原来的工程,此工程是很久以前使用eclipse创建的,在android studio下有些问题需要解决. 1.设置project的jdk, 2.设置modul ...
- SQL1224 is returned during the execution of an SQL procedure
SQL1224 is returned during the execution of an SQL procedure https://www.ibm.com/support/pages/sql12 ...
- 配置PostMan以访问、连接D365 / Dataverse环境
有人提出个问题说国内21V环境能否使用postman连接CRM? 官方链接:https://learn.microsoft.com/en-us/power-apps/developer/data-pl ...
- 栈和寄存器虚拟机比较(以python和lua为例)
指令长度 python python的指令定长,长度为16bit,其中8bit操作码,8bit操作数. ///@file: Python-3.6.0\Include\code.h typedef ui ...
- okHttp3源码简要分析
首先看一下使用, public static void main(String[] args) throws IOException { OkHttpClient client = new OkHtt ...
- Job for nfs-server.service failed because the control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details.
问题: 解决: