foreword
Sometimes, we may have such a requirement that when the condition is reached, the web page will play a prompt sound to inform the user.
accomplish
Of course, you can also write a tag to get the DOM through js to operate.
// Create <audio> tag (parameter: audio file path) const audio = new Audio('x.mp3'); // business logic if(1){ //... // play sound audio.play(); }
…
The post JavaScript – Playing audio files on PC via pure js (playing beeps) first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/8974
This site is for inclusion only, and the copyright belongs to the original author.