Why can't I play sounds more than once using HTML5 audio tag?

前端 未结 4 1009
时光取名叫无心
时光取名叫无心 2021-02-01 17:19

This is how the sound is \"stored\":


In the actual game (whi

4条回答
  •  被撕碎了的回忆
    2021-02-01 17:38

    I had this issue recently with an html5. Worked everywhere except safari. Using load() before calling play() solved this problem. It also helps to make sure that sound effects do not overlap with heavy clickers when event-handlers trigger sounds.

    Here what I used
    
    
    
    click here  
    
    
    
    Jquery
    $("#navigation-id") //this attached is to an element on the page
    .mouseover(function() {
        sound-one.load();                               
        sound-one.play();
        });
    

提交回复
热议问题