Autoplay sound in chrome background tab

前端 未结 3 758
醉梦人生
醉梦人生 2021-02-13 12:41

I have an HTML5 game that uses audio notifications.

When users are searching for other players with match-making they frequently change tabs to do other things and rely

3条回答
  •  旧时难觅i
    2021-02-13 13:35

    The solution that worked for me was to play a small blank sound (0.1 second is enough) once the page is loaded. After that even if you switch to another tab, the tab in the background will still be able to play the sound on some external or internal event.

提交回复
热议问题