Playing audio file returns “Uncaught (in promise)” but works in console

不羁的心 提交于 2019-12-03 12:32:54

If you read the full error message associated with the exception, you'll get a better explanation:

❌ Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

Google's article "Autoplay Policy Changes" (linked in the message above) explains the situation in detail.

The short version is: if you want to play audio or video, you need to wait to do it until the user has clicked something on the page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!