Chrome:: ERROR: Uncaught (in promise) DOMException

(latest edition of Chrome)
audio.src = "xxx";
audio.load ();
audio.play (); <-- ERROR: Uncaught (in promise) DOMException

this error should have occurred when the playback was performed without loading valid resources available for playback.
some people say that through setTimeout, it doesn"t work after trying, and the solution is not very reasonable.

about, after the page is loaded, customize the playback address through JS and perform playback.
want to know if there is a better solution, ask for help!


https://www.jianshu.com/p/57d...


try registering the loadend event callback function
https://developer.mozilla.org...

Menu