mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-13 14:00:52 -04: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
ffced16b95
commit
ef142107a6
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…
Add table
Add a link
Reference in a new issue