Open JinXJinX opened 5 years ago
Looks like Firefox is going to block audio autoplay too.
We expect to roll out audible autoplay blocking enabled by default, in Firefox 66, scheduled for general release on 19 March 2019
https://hacks.mozilla.org/2019/02/firefox-66-to-block-automatically-playing-audible-video-and-audio/
Why is this issue closed? The problem still exists in chrome 78 on mac and windows, not in firefox. The warnings are stopping, when you click in the project.
The issue seems to be unsolved; don't know what reasoning was behind closing it
Note that #5444 partially resolves this, but there needs to be a further change.
node_modules/scratch-audio/src/AudioEngine.js calls https://github.com/LLK/scratch-audio/blob/develop/src/StartAudioContext.js ; that also needs a fix
I fixed two sources and reduced the warning to only one occurrence.
class AudioEngine {
constructor (audioContext = new AudioContext(), autoStart = true) { /*FIXED: add 2nd arg*/
if(audioContext == null) { /*FIXED: if null, set new instance*/
audioContext = new AudioContext();
}
this.audioContext = audioContext;
if(autoStart) { /*FIXED: check 2nd arg*/
StartAudioContext(this.audioContext);
}
componentDidMount () {
if (!this.props.vm.initialized) {
this.audioEngine = new AudioEngine(null, false); /*FIXED: not start*/
The fix applies to https://marron9999.github.io/scratch-gui/
@marron9999 It doesn't seem to work.
the warn will stop when you drag any block into the stage!
Expected Behavior
No warnings in console for production build
Actual Behavior
Keep raising warning (The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu) before user click the page.
And this problem is exists in the current online version https://scratch.mit.edu/projects/editor
Steps to Reproduce
Operating System and Browser
related issue #2017