mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Remove the event listener for processing audio at the same time that we disconnect the script node. At this point we are closing the web socket and do not want to process more of the microphone data even if it is already in flight. Also add it back when we resume listening instead of just at init time.
This commit is contained in:
parent
e8ce37e776
commit
d2cff42a99
1 changed files with 2 additions and 0 deletions
|
@ -319,6 +319,7 @@ class Scratch3SpeechBlocks {
|
|||
// This is called on green flag to reset things that may never have existed
|
||||
// in the first place. Do a bunch of checks.
|
||||
if (this._scriptNode) {
|
||||
this._scriptNode.removeEventListener('audioprocess', this._processAudioCallback);
|
||||
this._scriptNode.disconnect();
|
||||
}
|
||||
if (this._sourceNode) {
|
||||
|
@ -522,6 +523,7 @@ class Scratch3SpeechBlocks {
|
|||
*/
|
||||
_resumeListening () {
|
||||
this._context.resume.bind(this._context);
|
||||
this._scriptNode.addEventListener('audioprocess', this._processAudioCallback);
|
||||
this._newWebsocket();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue