javascript - Safari 浏览器 audio.play() 不工作
问题描述
我正在使用以下音频标签<audio id="player"></audio>
,并且在 jquery 中我使用过
var player = document.getElementById('player');
player.src ='/ajax.php';
player.play();
Safari 浏览器显示以下错误且未播放音频。Unhandaled promise Rejection: NotSupportedError: The Operation is not supported
我已经搜索了这个,但没有得到任何适当的解决方案。有谁知道解决方案?提前致谢。
解决方案
请检查静音设置。
Unmute, if it is set to mute.
https://support.apple.com/kb/PH21463?locale=en_US
推荐阅读
- node.js - Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (72)
- entity-framework-core - EF Core:获取与过滤器匹配的实体,但仅获取那些通过复合键在其分组中具有最新日期时间属性的实体
- python - Python没有从H3标签返回文本
- windows - 如何使用批处理创建多行文本文件?
- javascript - 无法读取未定义私有路由的属性状态
- .net-core - Azure Web 作业 .net 核心禁用属性应用设置不起作用
- java - 使用反射库在 Java 中获取子类型
- google-analytics - 如何使用 Google Analytics (GA) 数据确定网站在 Power BI 上的会话
- jestjs - Jest+React Native 测试库:如何测试图像 src?
- javascript - 单击按钮更改图像位置