• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Jun 10, 2022 Jun 10, 2022

Copy link to clipboard

Copied

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?

Views

182

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 11, 2022 Jun 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

Votes

Translate

Translate
Explorer ,
Jun 10, 2022 Jun 10, 2022

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2022 Jun 11, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 11, 2022 Jun 11, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

You're welcome.

 

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

 

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

LATEST

and it's not just chrome.  all modern browsers (thankfully) require user interaction before playing a sound.

 

you should see it in action at virtually every website that has ads.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines