WebAudio Plugin and CreateJS broken in new Chrome Update

Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Problems with Audio on Chrome 66:

NO SOUNDS anymore on my web pages  (HTML5 CANVAS).

Everything was fine until yesterday (Chrome 65).

Google says:

"An AudioContext must be created or resumed after the document received a user gesture to enable audio playback."

Autoplay Policy Changes  |  Web  |  Google Developers

I have already a Touch Event inside of my canvas before the Sounds starts (which enables Sound in iOS)

- but Chrome does not react.

So,--- CREATEjs does not seem to deal with this "NEW SECURITY FEATURE"

Any ideas how to fix it or a work-around?

Views

3.1K

Likes

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

Explorer , Apr 19, 2018 Apr 19, 2018
Wow- I just discovered in the Console : Google Chrome overwrites the audio Style!No chance to overwrite it because of an additional !important attribute. That is NOT GOOD.. Google!So - I insert a (useless for the app) user interaction first in Frame 1 - and in Frame 2 I register/create/load the sound- and then i have to insert an additional user interaction to start the app WITH sound. Works - but I have to re-edit now all my Animate CC HTML5 Animations!!!Ans to many Clicks for the user..really....

Likes

Translate

Translate
Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Wow- I just discovered in the Console : Google Chrome overwrites the audio Style!

No chance to overwrite it because of an additional !important attribute.

That is NOT GOOD.. Google!

Bildschirmfoto 2018-04-20 um 08.04.14.png

So - I insert a (useless for the app) user interaction first in Frame 1

- and in Frame 2 I register/create/load the sound

- and then i have to insert an additional user interaction to start the app WITH sound.

Works - but I have to re-edit now all my Animate CC HTML5 Animations!!!

Ans to many Clicks for the user..really.

Maybe CreateJS and/or Adobe can insert a fix for that, thanks.

Likes

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 ,
May 05, 2018 May 05, 2018

Copy link to clipboard

Copied

Overriding of createjs.Sound.play might help, I made this little snippet which can be put anywhere in js file after loading createjs (this code in html <script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>)
It's createjs' own play method (from the minified source) on "steroids"

createjs.Sound.play = function(a, b, d, e, f, g, h, i, j)

{

   if(createjs.Sound.activePlugin.context && createjs.Sound.activePlugin.context.state==="suspended")
  {
   createjs.Sound.activePlugin.context.resume();
  }
   var k;
   k = b instanceof Object || b instanceof createjs.PlayPropsConfig ? createjs.PlayPropsConfig.create(b) : createjs.PlayPropsConfig.create({
   interrupt: b,
   delay: d,
   offset: e,
   loop: f,
   volume: g,
   pan: h,
   startTime: i,
   duration: j
  });
   var l = createjs.Sound.createInstance(a, k.startTime, k.duration),

   m = createjs.Sound._playInstance(l, k);

   return m || l._playFailed(), l;

};

Likes

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
New Here ,
May 09, 2018 May 09, 2018

Copy link to clipboard

Copied

I got the same problem and there is my fix :

Solution : Is SoundJS effected by recent changes to Chrome autoplay? · Issue #297 · CreateJS/SoundJS · GitHub

$( document ).ready(function() {

    //HTML button that start animation

    $('.btn_clip').on('click',function(e){       

        e.preventDefault();

        resumeAudioContext();

        myclip.play();

    });

    // FIX Chrome autoplay security: https://github.com/CreateJS/SoundJS/issues/297

    var resumeAudioContext = function() {

    // handler for fixing suspended audio context in Chrome

    try {

      if (createjs.WebAudioPlugin.context.state === "suspended") {

        createjs.WebAudioPlugin.context.resume();

        // Should only need to fire once

        window.removeEventListener("click", resumeAudioContext);

      }

    } catch (e) {

      // SoundJS context or web audio plugin may not exist

      console.error("There was an error while trying to resume the SoundJS Web Audio context...");

      console.error(e);

    }

  };

});

Likes

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 ,
May 22, 2018 May 22, 2018

Copy link to clipboard

Copied

LATEST

UPDATE from GOOGLE (Adobe please listen and adapt Animate CC/CreateJS):

We've updated Chrome 66 to temporarily remove the autoplay policy for the Web Audio API.
This change does not affect most media playback on the web, as the autoplay policy will remain in effect for <video> and <audio>.

We’re doing this to give Web Audio API developers more time to update their code. The team here is working hard to improve things for users and developers, but in this case we didn’t do a good job of communicating the impact of the new autoplay policy to developers using the Web Audio API.

The policy will be re-applied to the Web Audio API in Chrome 70 (October).


Here is the relevant post in the Chrome bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=840866#c103

Likes

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