简体   繁体   中英

Play audio on specific time from database

I'm building a audioplayer based on Howler.js that plays audio on specific time without refreshing. The plan is to make a small CMS system where I can make the schedule including the audio file.

The challenging part: How can I read my database (MySQL) realtime checking if it's time to play? it's working by checking the database every second (And reloading the page), but I think it's not a solution. ;-)

Is there someone with a brilliant advice?

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onended


let sound=new Audio('sound.mp3');
sound.play(); // play sound

sound.onended=function (){

   alert('sound the end');

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM