代码:
var mp3Url = require('@/assets/audio/new_msg.wav');
var player = new Audio(mp3Url);
player.play(); //播放 mp3这个音频对象
播放音频时,报错:
Uncaught (in promise) DOMException: play() failed because the user didn't interact with the docum
说明:文章来源:https://www.toymoban.com/news/detail-594710.html
google浏览器必须在用户与页面进行交互后,才能进行播放音频。文章来源地址https://www.toymoban.com/news/detail-594710.html
到了这里,关于js播放音频 Uncaught (in promise) DOMException: play() failed because the user didn‘t interact with的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!