Title: Heads up: Chrome 70 (due in October) will restore a content policy that breaks most&#x2F;all WebAudio content that hasn&#x27;t been fixed to follow the policy.<p><i>Edit:</i> Note that in general, content will break even if it follows the intent of the policy (by only playing sounds in response to user input). This is due to the nature of Chrome&#x27;s implementation of the policy.<p>If you maintain any WebAudio code the fix is below. For any code that hasn&#x27;t been fixed and isn&#x27;t maintained, expect it to stop working soon in Chrome. :(<p>--<p>Background:<p>This is part of the &quot;no autoplaying&quot; policy that rolled out in Chrome 66, and was reverted for WebAudio a few days later because it broke everything (including Chrome&#x27;s own webaudio demos). Chrome 70 apparently restores the same implementation, so any content that broke before will break again, unless patched.<p>Past HN discussion: https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17079724<p>Policy info: https:&#x2F;&#x2F;developers.google.com&#x2F;web&#x2F;updates&#x2F;2017&#x2F;09&#x2F;autoplay-policy-changes#webaudio<p>--<p>Fix and tech details:<p>The easiest fix is to add a redundant `ctx.resume()` call to any user input event handler. Once that fires, the audioContext will work normally.<p>Basically Chrome&#x27;s implementation of the policy doesn&#x27;t look at when an audioContext <i>plays sounds</i>, it only cares when (a) the context is created, and (b) `context.resume()` is called. If either of those happens inside a user event handler, that context can play sounds. But if you create a context at startup and never call `resume` (like most WebAudio demos), the context will be muted regardless of whether it waits for user input.
Upvote: