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

Audio Issue: how to call sounds correctly? (Html5 canvas games)

Community Beginner ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

Hi, 

I´m having an audio issue with several games I have made with  Animate cc html5 canvas. The problem is the " Autoplay policy" of Chrome and other browsers:
 "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page." 
 
Although my audios starts after the user interacts with the game, this doesn't seem to be enough because the error keeps showing up in the browser.
 
I guess they must be called or declared in a different way than I'm used to.
 
I simply put the sounds on the timeline of a movie clip and then play them, some when the user clicks a button, and others through code when the user hits or misses.
 
I have searched for the solution but I can't find it, I will be very grateful if someone can share their way to use sounds in the correct way.
TOPICS
Error

Views

428

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 ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

i use a landing/welcome/instructions page with no sound.  a button is required to move to the next keyframe where sounds can be started then or thereafter.

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 Beginner ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

Thanks for your answer, but I assume there is a specific way to declare sounds because I see that just putting them in the Library already generates "The AudioContext was not allowed to start" warning in Chrome, without even using them on stage.
Is it so?

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 ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

that's a warning and means nothing unless it's re-declared when the sound should start.

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
LEGEND ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

LATEST

What kglad said seems right, it takes a user action to have to trigger the sound. One good thing, it's a once per session check, they don't have to click for every time you want to play a sound to them. Make your landing page Start button start the experience, and also play a sound.

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