Skip to main content
Inspiring
Jun 11, 2022 2:18 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
    JoãoCésar17023019
    JoãoCésar17023019Correct answer
    Community Expert
    Jun 11, 2022 5:01 PM UTC

    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

    5 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    Jun 11, 2022 5:01 PM UTC

    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

    Translate
    beatbumAuthor
    Inspiring
    Jun 11, 2022 7:00 PM UTC

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

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    Jun 12, 2022 2:02 PM UTC

    You're welcome.

     

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

     

    Regards,

    JC

    Translate
    beatbumAuthor
    Inspiring
    Jun 11, 2022 2:52 AM UTC

    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. 

    Translate