Skip to main content
Inspiring
June 11, 2022
Answered

How to avoid having the user click to play sounds in Chrome?

  • June 11, 2022
  • 2 replies
  • 320 views

I tried createjs.Sound but my sounds have nothing under Linkage in the library. I think that's what you need to reference the sound when using createjs.Sound right? Any other ways to avoid the user having to arbitrarily click to hear sounds?

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    Chrome requires a user to interact with a page to allow sound playback but only once. So as long as the user, for example, clicked on a button, you can play sounds afterwards without interaction.

     

    But there's no way to avoid this first interaction as far as I can tell.

     

    Regards,

    JC

    2 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    June 11, 2022

    Hi.

     

    Chrome requires a user to interact with a page to allow sound playback but only once. So as long as the user, for example, clicked on a button, you can play sounds afterwards without interaction.

     

    But there's no way to avoid this first interaction as far as I can tell.

     

    Regards,

    JC

    beatbumAuthor
    Inspiring
    June 11, 2022

    rats. I thought that createjs could do it. Ok thanks, I'll have a popup that says "choose an activity" with an OK button.

    JoãoCésar17023019
    Community Expert
    Community Expert
    June 12, 2022

    You're welcome.

     

    It's not just CreateJS. No technology is able to overcome this limitation without some kind of hack.

     

    Regards,

    JC

    beatbumAuthor
    Inspiring
    June 11, 2022

    ok well I found out how to add a Linkage name. Simply double-click the Linkage area next to the library item. 

    This is the code I tried:

    createjs.Sound.play("Swish");

    Doesn't work. Still have to click to hear sounds.