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?
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.
M
...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!
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.
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;
};
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);
}
};
});
Copy link to clipboard
Copied
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